Skip to content

Commit 46c627c

Browse files
committed
feat: add getPageBlocks utility to fetch and parse Notion page blocks
1 parent b794ada commit 46c627c

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

packages/notion-to-utils/src/client/getPageBlocks.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,19 @@ async function fetchBlockChildren(
9797
const bookmarkBlock = block as any;
9898
const bookmarkUrl = bookmarkBlock.bookmark.url;
9999

100+
const options = {
101+
url: bookmarkUrl,
102+
headers: {
103+
'user-agent':
104+
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36',
105+
accept:
106+
'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8',
107+
'cache-control': 'max-age=0',
108+
},
109+
};
110+
100111
// open-graph-scraper를 이용한 메타데이터 추출
101-
const { result } = await ogs({ url: bookmarkUrl });
112+
const { result } = await ogs(options);
102113

103114
const parsedUrl = new URL(bookmarkUrl);
104115
const domain = parsedUrl.hostname;

0 commit comments

Comments
 (0)