Skip to content

Crawlee—A web scraping and browser automation library for Node.js to build reliable crawlers. In JavaScript and TypeScript. Extract data for AI, LLMs, RAG, or GPTs. Download HTML, PDF, JPG, PNG, and other files from websites. Works with Puppeteer, Playwright, Cheerio, JSDOM, and raw HTTP. Both headful and headless mode. With proxy rotation.

improved session docs.

Petr Patek4b3be97856c1
diff --git a/docs/api/Session.md b/docs/api/Session.md
index a2c5c127f..654dc1d24 100644
--- a/docs/api/Session.md
+++ b/docs/api/Session.md
@@ -158,7 +158,7 @@ Increases usage and error count. Should be used when the session has been used u
Retires session based on status code.
-**Returns**: `boolean` - - whether the session was retired
+**Returns**: `boolean` - whether the session was retired.
<table>
<thead>
@@ -178,7 +178,7 @@ Retires session based on status code.
## `session.setCookiesToJar(response)`
-Sets cookies from response to the cookieJar. Parses cookies from "set-cookie" header and sets them to "Session.cookieJar".
+Sets cookies from response to the cookieJar. Parses cookies from `set-cookie` header and sets them to `Session.cookieJar`.
<table>
<thead>
@@ -197,9 +197,9 @@ Sets cookies from response to the cookieJar. Parses cookies from "set-cookie" he
## `session.getCookieString(url)` ⇒ `String`
-Wrapper around "tough" cookie jar `getCookieString` method.
+Wrapper around `tough-cookie` Cookie jar `getCookieString` method.
-**Returns**: `String` - ;
+**Returns**: `String` - String representing `Cookie` header.
<table>
<thead>
diff --git a/src/session_pool/session.js b/src/session_pool/session.js
index 633396ce3..78fe97323 100644
--- a/src/session_pool/session.js
+++ b/src/session_pool/session.js
@@ -182,7 +182,7 @@ export class Session {
/**
* Retires session based on status code.
* @param statusCode {Number} - HTTP status code
- * @return {boolean} - whether the session was retired
+ * @return {boolean} whether the session was retired.
*/
checkStatus(statusCode) {
const isBlocked = STATUS_CODES_BLOCKED.includes(statusCode);
@@ -194,7 +194,7 @@ export class Session {
/**
* Sets cookies from response to the cookieJar.
- * Parses cookies from "set-cookie" header and sets them to "Session.cookieJar".
+ * Parses cookies from `set-cookie` header and sets them to `Session.cookieJar`.
* @param response
*/
setCookiesToJar(response) {
@@ -206,9 +206,9 @@ export class Session {
}
/**
- * Wrapper around "tough" cookie jar `getCookieString` method.
+ * Wrapper around `tough-cookie` Cookie jar `getCookieString` method.
* @param url
- * @return {String};
+ * @return {String} String representing `Cookie` header.
*/
getCookieString(url) {
console.log(this.cookieJar);