get-notion-contents
Advanced tools
Comparing version 2.2.0 to 2.3.0
@@ -10,3 +10,3 @@ import { Option, NotionUser, NotionContent } from './types'; | ||
private userContent; | ||
constructor(token: string, option?: Option); | ||
constructor(token?: string, option?: Option); | ||
private getUserContent; | ||
@@ -13,0 +13,0 @@ getUser(): Promise<NotionUser>; |
@@ -19,7 +19,4 @@ "use strict"; | ||
class Notion { | ||
constructor(token, option = { prefix: '/', removeStyle: false }) { | ||
constructor(token = null, option = { prefix: '/', removeStyle: false }) { | ||
var _a; | ||
if (!token) { | ||
throw new Error('Token MUST be provided.'); | ||
} | ||
this.token = token; | ||
@@ -34,2 +31,5 @@ this.option = { | ||
try { | ||
if (this.token == null) { | ||
throw new Error('You need to pass the token to get your user data.'); | ||
} | ||
const response = yield request_1.default('loadUserContent', this.token); | ||
@@ -36,0 +36,0 @@ const result = yield response.json(); |
@@ -24,3 +24,3 @@ "use strict"; | ||
`); | ||
const buildHtml = (pageId, token, option) => __awaiter(void 0, void 0, void 0, function* () { | ||
const buildHtml = (pageId, token = null, option) => __awaiter(void 0, void 0, void 0, function* () { | ||
process.setMaxListeners(0); | ||
@@ -31,4 +31,5 @@ try { | ||
yield page.goto(`https://www.notion.so/${pageId.split('-').join('')}`); | ||
const cookie = [{ name: 'token_v2', value: token }]; | ||
yield page.setCookie(...cookie); | ||
if (token != null) { | ||
yield page.setCookie({ name: 'token_v2', value: token }); | ||
} | ||
yield page.waitForSelector('#notion-app'); | ||
@@ -35,0 +36,0 @@ yield page.waitFor(20000); |
{ | ||
"name": "get-notion-contents", | ||
"version": "2.2.0", | ||
"version": "2.3.0", | ||
"description": "Get contents from notion", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -14,3 +14,3 @@ # get-notion-contents | ||
## ⚠️ Prerequisite | ||
You need a token to use this package. | ||
You need a token to use this package if you want to get private contents. | ||
You can get it from [Notion.so](https://www.notion.so/) cookie. the key of it is `token_v2`. | ||
@@ -17,0 +17,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21123
403