Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot get expect Html #10

Open
dxcqcv opened this issue Mar 10, 2020 · 3 comments
Open

Cannot get expect Html #10

dxcqcv opened this issue Mar 10, 2020 · 3 comments
Labels
bug Something isn't working

Comments

@dxcqcv
Copy link

dxcqcv commented Mar 10, 2020

I run notion-api-js in nodejs, but I cannot get right html content

expect html is like that

<div>music-song</div>
...
and so on

but return cotent is


[ { HTML:
     '<div><h1 >Get Started</h1><p>👋 Welcome! This is a private page for you to play around with. </p><br /><p>Give these things a try:</p><br /><br /><p style="color:undefined">Have a question?</p></div>',
    Attributes:
     { title: 'Get Started',
       slug: 'get-started',
       cover: null,
       teaser:
        'Get Started 👋 Welcome! This is a private page for you to play around with.  Give these things a try: Have a question?',
       icon: null,
       id: '9bdfefb9-56af-4a3c-b21e-4301a99f6994' } },

so the return html content is total wrong? and I also use Token, why cannot get right html content?

my code is

// require syntax
const Notion = require("notion-api-js").default;


const pageUrl = "https://www.notion.so/2628769120ad41d998ec068d6e2eb410?v=e8e69ac68a8d483792c54541e4d8ba72"
const token = "acf60ab1255a12c6c101e5beb6b776a767c25a2339ea86f0d5ac5a9abc25cbb7c1e27f439adbd9cdae1bb717f02ccf739dc694c42c86018f7b136b81ce2bbcdda4f1abd6672489231d2f3835c16c"

const notion = new Notion({
  token ,
  options: {
    pageUrl 
  }
});

notion.getAllHTML().then(html => {
  // Your Code here
  console.log(html)
});
@Aceto1
Copy link
Collaborator

Aceto1 commented Mar 24, 2020

I'll have a look at this some time this week.

@Aceto1 Aceto1 added the bug Something isn't working label Mar 24, 2020
@chanjungkim
Copy link

chanjungkim commented May 22, 2020

I also get JSON instead of full HTML. And also, in the JSON, there's no workspace part.. It seems like it only gets private things.

@cstrnt
Copy link
Owner

cstrnt commented Feb 11, 2021

@dxcqcv Hi there,
sorry for the inactivity! You are using the pageUrl property in a wrong way.
To get the data for a certain page you need to call the getPageById method :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants