Giter Site home page Giter Site logo

notion2md's Introduction

Notion2Md logo - an arrow pointing from "N" to "MD"


About Notion2Md

Downloads PyPI version Code Quality

  • Notion Markdown Exporter using official notion api by notion-sdk-py

Notion2Medium

  • Check out Notion2Medium that publishes a Medium post from Notion using Notion2Md.

API Key(Token)

$ export NOTION_TOKEN="{your integration token key}"

Install

$ pip install notion2md

Usage: Shell Command

Terminal output of the notion2md -h command

  • Notion2md requires either id or url of the Notion page/block.

  • download option will download files/images in the path directory.

  • unzipped option makes Notion2Md export unzipped output of Notion block.

notion2md --download -n post -p ~/MyBlog/content/posts -u https://notion.so/...
  • This command will generate "post.zip" in your '~/MyBlog/content/posts' directory.

Usage: Python

from notion2md.exporter.block import MarkdownExporter, StringExporter

# MarkdownExporter will make markdown file on your output path
MarkdownExporter(block_id='...',output_path='...',download=True).export()

# StringExporter will return output as String type
md = StringExporter(block_id='...',output_path='...').export()

To-do

  • Download file object(image and files)
  • Table blocks
  • Synced Block
  • Page Exporter
  • Child page
  • Column List and Column Blocks

Contribution

Please read Contribution Guide

Donation

If you think Notion2Md is helpful to you, you can support me here:

Buy Me A Coffee

License

MIT

notion2md's People

Contributors

echo724 avatar felixthebeard avatar george3d6 avatar hukq16 avatar merkulovdaniil avatar miclgael avatar mrnerdhair avatar nishant127 avatar phoenixeliot avatar semantic-release-bot avatar zhangweidev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

notion2md's Issues

KeyError: 'text'

System:

  • Python 3.7
  • notion2md: 2.2.5 from pip install

Here is the error show on python, I tried a simple page it works but with other more complex page have many blocks, it seems have problems:
image
And here is the error text:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/kin/anaconda3/envs/py37/lib/python3.7/site-packages/notion2md/exporter.py", line 18, in block_exporter
    output.write(blocks_convertor(blocks))
  File "/home/kin/anaconda3/envs/py37/lib/python3.7/site-packages/notion2md/convertor/block.py", line 109, in blocks_convertor
    outcome_blocks = "".join([result for result in results])
  File "/home/kin/anaconda3/envs/py37/lib/python3.7/site-packages/notion2md/convertor/block.py", line 109, in <listcomp>
    outcome_blocks = "".join([result for result in results])
  File "/home/kin/anaconda3/envs/py37/lib/python3.7/concurrent/futures/_base.py", line 598, in result_iterator
    yield fs.pop().result()
  File "/home/kin/anaconda3/envs/py37/lib/python3.7/concurrent/futures/_base.py", line 428, in result
    return self.__get_result()
  File "/home/kin/anaconda3/envs/py37/lib/python3.7/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
  File "/home/kin/anaconda3/envs/py37/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/kin/anaconda3/envs/py37/lib/python3.7/site-packages/notion2md/convertor/block.py", line 140, in block_convertor
    outcome_block = block_type_map[block_type](information_collector(block[block_type])) + "\n\n"
  File "/home/kin/anaconda3/envs/py37/lib/python3.7/site-packages/notion2md/convertor/block.py", line 115, in information_collector
    information['text'] = richtext_convertor(payload['text'])
  File "/home/kin/anaconda3/envs/py37/lib/python3.7/site-packages/notion2md/convertor/richtext.py", line 48, in richtext_convertor
    outcome_word = link(richtext["text"])
KeyError: 'text'

Error

Getting error:
ERROR Could not find block with ID: xxx. Make sure the relevant pages and databases are shared with your integration.

What can be the problem?

Error

Traceback (most recent call last):
  File "/usr/local/Cellar/[email protected]/3.9.2_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/local/Cellar/[email protected]/3.9.2_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/Users/tianmeiwz/Downloads/notion2md-main/notion2md/__main__.py", line 4, in <module>
    export_cli()
  File "/Users/tianmeiwz/Downloads/notion2md-main/notion2md/export_manager.py", line 28, in export_cli
    exporter = PageBlockExporter(url,client,blog_mode=blog_mode)
  File "/Users/tianmeiwz/Downloads/notion2md-main/notion2md/exporter.py", line 9, in __init__
    self.page = self.client.get_block(url)
  File "/usr/local/lib/python3.9/site-packages/notion/client.py", line 169, in get_block
    block = self.get_record_data("block", block_id, force_refresh=force_refresh)
  File "/usr/local/lib/python3.9/site-packages/notion/client.py", line 162, in get_record_data
    return self._store.get(table, id, force_refresh=force_refresh)
  File "/usr/local/lib/python3.9/site-packages/notion/store.py", line 184, in get
    self.call_load_page_chunk(id)
  File "/usr/local/lib/python3.9/site-packages/notion/store.py", line 286, in call_load_page_chunk
    recordmap = self._client.post("loadPageChunk", data).json()["recordMap"]
  File "/usr/local/lib/python3.9/site-packages/notion/client.py", line 260, in post
    raise HTTPError(
requests.exceptions.HTTPError: Invalid input.

IndentationError: expected an indented block

$ python3 -m notion2md
Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 185, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/usr/lib/python3.8/runpy.py", line 144, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/usr/lib/python3.8/runpy.py", line 111, in _get_module_details
    __import__(pkg_name)
  File "/usr/local/lib/python3.8/dist-packages/notion2md/__init__.py", line 1, in <module>
    from .export_manager import export_cli
  File "/usr/local/lib/python3.8/dist-packages/notion2md/export_manager.py", line 5, in <module>
    from notion2md.exporter import PageBlockExporter
  File "/usr/local/lib/python3.8/dist-packages/notion2md/exporter.py", line 345
    """This function will get inline math code and append it to the text
"""
    ^
IndentationError: expected an indented block

fix: add four spaces before notion2md/exporter.py line 345 and 346:

Export files as Zip

Export as folders and files are not simple.

By adding exporting as zip feature, I hope the output file stays simple

100 blocks limit

hello~
I find that I can only get the first 100 blocks when I use notion2md to convert a notion page whose blocks is more than 100 blocks. And I want to know how to solve it?

There is a problem with synced block.

  1. When the page have synced block, there is some problem.
  2. When the page have many pictures, just one picture would be saved if these pictures have default name(Untitled.png). And the
  3. In the code, some GLobal variables may cause some troubles.

No images exported

Hey, so happy I found this project! Looking to jump to a note-taking app that is more open.

Quick question. I'm exporting my page, but none of the images in the page are being exported. There's no image folder, and where the images were in the original notion page there is just empty space.

Any thoughts?

Export truncated at italic

How to reproduce:
Try to export a page where in the middle of the phrase some words are written in italic.

Result:
The exported text is truncated at the start of the italic words.

Export Failed: File name too long

Dear developers,
I have used the notion2md for some times. It helps me a lot. Thanks for your wonderful work. However, I encountered a question:
When exporting a file with a Chinese name, the following error occurs:

      ERROR [Errno 36] File name too long: '/data/vorfreuder/posts/dbe986d2_%E8%BF%99%E6%98%AF%E4%B8%80%E4%B8%AA%E7%94%A8%E4%BA%8E%E6%B5%8B%E8%AF%95%E7%9A%84%E5%90%8D%E5%AD%97%E9%9D%9E%E5%B8%B8%E9%95%BF%E7%9A%84%E6%96%87%E4%BB%B6%E8%BF%99%E6%98%AF%E4%B8%80%E4%B8%AA%E7%94%A8%E4%BA%8E%E6%B5%8B%E8%AF%95%E7%9A%84%E5%90%8D%E5%AD%97%E9%9D%9E%E5%B8%B8%E9%95%BF%E7%9A%84%E6%96%87%E4%BB%B6.docx': Error occured block_type:file

I believe the issue might be due to the Chinese characters being encoded and resulting in excessive length. When the length of fullpath in notion2md/convertor/block.py#L173 exceeds 276 characters, it triggers a "File name too long" error.

        self._io.write_line(status("Downloading", f"{file_name}"))
---->   request.urlretrieve(url, fullpath)
        self._io.write_line(
            success(
                "Downloaded",
                f'"{file_name}" -> "{downloaded_file_name}"',
            )
        )

One possible solution could be:

from urllib.parse import urlparse, unquote
    def download_file(self, url: str) -> str:
        file_name = os.path.basename(urlparse(url).path)
        file_name = unquote(file_name)
        ...

Python usage in Readme is not updated

The python code example in the readme doesn't work, for example for import.

from notion2md.exporter import markdown_exporter, string_exporter

# block_markdown_exporter will make markdown file on your output path
markdown_exporter(page_id='...',output_path='...',download=True)

# block_string_exporter will return output as String type
md = string_exporter(page_id='...',output_path='...')

The example should be updated with the new architecture.

from notion2md.exporter.block import StringExporter

exporter = StringExporter(block_url="...")

Exporting every pages

Is there a way to export every pages that we have in notion ? A sort of big backup of everything. If not, could you add this option please.

You could also provide a restore from backup option in order to upload our files to a new account.

Key error 'url' in information object

 Retrieving blocks from '815a2796158b41c4990fa9a04272e9a4'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/kin/anaconda3/envs/py37/lib/python3.7/site-packages/notion2md/exporter.py", line 18, in block_exporter
    output.write(blocks_convertor(blocks))
  File "/home/kin/anaconda3/envs/py37/lib/python3.7/site-packages/notion2md/convertor/block.py", line 109, in blocks_convertor
    outcome_blocks = "".join([result for result in results])
  File "/home/kin/anaconda3/envs/py37/lib/python3.7/site-packages/notion2md/convertor/block.py", line 109, in <listcomp>
    outcome_blocks = "".join([result for result in results])
  File "/home/kin/anaconda3/envs/py37/lib/python3.7/concurrent/futures/_base.py", line 598, in result_iterator
    yield fs.pop().result()
  File "/home/kin/anaconda3/envs/py37/lib/python3.7/concurrent/futures/_base.py", line 428, in result
    return self.__get_result()
  File "/home/kin/anaconda3/envs/py37/lib/python3.7/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
  File "/home/kin/anaconda3/envs/py37/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/kin/anaconda3/envs/py37/lib/python3.7/site-packages/notion2md/convertor/block.py", line 151, in block_convertor
    outcome_block += "\t"*depth + block_convertor(block,depth)
  File "/home/kin/anaconda3/envs/py37/lib/python3.7/site-packages/notion2md/convertor/block.py", line 140, in block_convertor
    outcome_block = block_type_map[block_type](information_collector(block[block_type])) + "\n\n"
  File "/home/kin/anaconda3/envs/py37/lib/python3.7/site-packages/notion2md/convertor/block.py", line 67, in image
    return f"![{information['url']}]({information['url']})\n\n{information['caption']}"
KeyError: 'url'

It seems also have other... error like URL?

Originally posted by @Kin-Zhang in #18 (comment)

Option to export multiple files

Hi @echo724, I discovered that when the markdown_exporter is called multiple times for different notion block id, the same notion block is being exported. I think the reason is that Config class being a singleton, is it possible to change this implementation?

refactor Exporter

It was a long time ago when my collaborators and I wrote the source code for Notion2MD, and it worked fine.
Over time, I identified a few areas that could be improved and refactored, so I'm planning to fix them

pass in token as a parameter to MarkdownExporter

Currently, there is no way to pass the Notion_Token as a parameter to the MarkdownExporter. This means that the only way for it to work in a python script is to set the environment variable to the correct notion_token.

Can we add notion_token as parameter to markdownexporter and check if it's passed use whatever was passed otherwise fetch from os.environ ?

This makes it hard to work with multiple notion keys in the same code.

Cat make it work

Hi,

I tried a while and I am not sure what I am doing wrong here. I have the following page for testing (published it for demo purposes):

https://www.notion.so/77824377786043c88e9e3acb7522ba1e?v=a8b9291a45ab4f28acfb16015f32523a

I thought that either the url until "?" is the correct url or the ID after the first "/" would be the ID.

I followed to create an integration which has read rights (only read rights). I used the given CLI command to add the token as an env var.

export NOTION_TOKEN="secret_12345566"  

then I called the following:

notion2md --download -n post -p ./notionpage/posts/ -i 77824377786043c88e9e3acb7522ba1e

But I only get:

Retrieving Notion blocks... (0.4s)

      ERROR Could not find block with ID: 77824377-7860-43c8-8e9e-3acb7522ba1e. Make sure the relevant pages and databases are shared with your integration.

I must do something wrong here. Could you give me a hint?

ERROR 'text'

Running notion2md results in error statement: ERROR 'text'

Using notion2md version 2.7.6
Ubuntu 20.04
Python version 3.8.10

Notion page content (exported to markdown)
Test page 19d3bdf4aade48438defa1b44d18031a.md

I've also tried calling the StringExporter() function from within a Python script and get the exact same error.
Traceback ends at line 39 with KeyError: 'text'

The number of retrieving notion blocks

Dear developers,
I have used the notion2md for some times. It helps me a lot. Thanks for your wonderful work. However, I encountered a question: When I want to export a large notion page to markdown, the notion2md just retrieves 100 blocks, regardless of how many blocks are within the page. The following is the output. What's going on?

 Retrieving Notion blocks... (0.0s)
  Retrieved Notion blocks... (4.6s)

 Converting 100 blocks...
Downloading Untitled.png
Downloading Untitled.png
Downloading Untitled.png
Downloading Untitled.png
Downloading Untitled.png
Downloading Untitled.png
Downloading Untitled.png
Downloading Untitled.png
Downloading Untitled.png
Downloading Untitled.png
Downloading Untitled.png
Downloading Untitled.png
Downloading Untitled.png
Downloading Untitled.png
Downloading Untitled.png
Downloading Untitled.png
Downloading Untitled.png
 Downloaded "Untitled.png" -> "70694ffc.png"
 Downloaded "Untitled.png" -> "02c96085.png"
 Downloaded "Untitled.png" -> "8db9abff.png"
 Downloaded "Untitled.png" -> "1a78a0cb.png"
 Downloaded "Untitled.png" -> "ca3ae22d.png"
 Downloaded "Untitled.png" -> "ac2eea2b.png"
 Downloaded "Untitled.png" -> "6c650d80.png"
 Downloaded "Untitled.png" -> "91a186c3.png"
 Downloaded "Untitled.png" -> "fcdba86b.png"
 Downloaded "Untitled.png" -> "5eb8bfd4.png"
 Downloaded "Untitled.png" -> "abce28de.png"
 Downloaded "Untitled.png" -> "32bdc30c.png"
 Downloaded "Untitled.png" -> "f62be712.png"
 Downloaded "Untitled.png" -> "6b2ba1ce.png"
 Downloaded "Untitled.png" -> "743bc2c4.png"
 Downloaded "Untitled.png" -> "800f7f5e.png"
 Downloaded "Untitled.png" -> "f768e0db.png"
  Converted 100 blocks to Markdown (15.0s)
   Exported "ch4.zip" in "./.\blog\/"

Bug: Python package not working?

Hi @echo724 , I just installed this python package and it doesn't seem to work in the latest version. I installed the latest version from here - https://pypi.org/project/notion2md/2.2.2/ - and tried replicating what was mentioned in the README. Can you please help check what's going wrong here @echo724 - seems like a bug?

The import error is this - ImportError: cannot import name 'notion_client_object' from 'notion2md.client_handler' (/Users/macos/opt/anaconda3/lib/python3.8/site-packages/notion2md/client_handler.py).

See detailed stack-trace below with installation logs as well:

(base) macos@88665a14b29c scripts % pip install notion2md==2.2.2
Collecting notion2md==2.2.2
  Using cached notion2md-2.2.2-py3-none-any.whl (7.5 kB)
Requirement already satisfied: notion-client>=0.7.1 in /Users/macos/opt/anaconda3/lib/python3.8/site-packages (from notion2md==2.2.2) (0.8.0)
Requirement already satisfied: httpx>=0.15.0 in /Users/macos/opt/anaconda3/lib/python3.8/site-packages (from notion-client>=0.7.1->notion2md==2.2.2) (0.21.1)
Requirement already satisfied: sniffio in /Users/macos/opt/anaconda3/lib/python3.8/site-packages (from httpx>=0.15.0->notion-client>=0.7.1->notion2md==2.2.2) (1.2.0)
Requirement already satisfied: httpcore<0.15.0,>=0.14.0 in /Users/macos/opt/anaconda3/lib/python3.8/site-packages (from httpx>=0.15.0->notion-client>=0.7.1->notion2md==2.2.2) (0.14.3)
Requirement already satisfied: charset-normalizer in /Users/macos/opt/anaconda3/lib/python3.8/site-packages (from httpx>=0.15.0->notion-client>=0.7.1->notion2md==2.2.2) (2.0.9)
Requirement already satisfied: rfc3986[idna2008]<2,>=1.3 in /Users/macos/opt/anaconda3/lib/python3.8/site-packages (from httpx>=0.15.0->notion-client>=0.7.1->notion2md==2.2.2) (1.5.0)
Requirement already satisfied: certifi in /Users/macos/opt/anaconda3/lib/python3.8/site-packages (from httpx>=0.15.0->notion-client>=0.7.1->notion2md==2.2.2) (2020.12.5)
Requirement already satisfied: anyio==3.* in /Users/macos/opt/anaconda3/lib/python3.8/site-packages (from httpcore<0.15.0,>=0.14.0->httpx>=0.15.0->notion-client>=0.7.1->notion2md==2.2.2) (3.4.0)
Requirement already satisfied: h11<0.13,>=0.11 in /Users/macos/opt/anaconda3/lib/python3.8/site-packages (from httpcore<0.15.0,>=0.14.0->httpx>=0.15.0->notion-client>=0.7.1->notion2md==2.2.2) (0.12.0)
Requirement already satisfied: idna>=2.8 in /Users/macos/opt/anaconda3/lib/python3.8/site-packages (from anyio==3.*->httpcore<0.15.0,>=0.14.0->httpx>=0.15.0->notion-client>=0.7.1->notion2md==2.2.2) (2.10)
Installing collected packages: notion2md
Successfully installed notion2md-2.2.2
(base) macos@88665a14b29c scripts % python
Python 3.8.8 (default, Apr 13 2021, 12:59:45)
[Clang 10.0.0 ] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from notion2md.exporter import block_exporter
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/macos/opt/anaconda3/lib/python3.8/site-packages/notion2md/exporter.py", line 1, in <module>
    from notion2md.client_handler import notion_client_object
ImportError: cannot import name 'notion_client_object' from 'notion2md.client_handler' (/Users/macos/opt/anaconda3/lib/python3.8/site-packages/notion2md/client_handler.py)
>>>
>>> #output_path is optional
>>> block_exporter("id of notion page","OutPut Path(Relative)")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'block_exporter' is not defined
>>>

Encoding issue (No UTF-8 support)

When i use utf-8 characters, there is an issue. I have to add the encoding in the exporter.py, to solve the issue

    with open(os.path.join(output_path,block_title+'.md'),'w', encoding="utf-8") as output:
        output.write(blocks_convertor(blocks))

export failed

notion2md --download -n post -p ~/Desktop/posts -u https://www.notion.so/306c4eb9ed9b42b0b15a57730394c5e9
Retrieving blocks from '306c4eb9-ed9b-42b0-b15a-57730394c5e9'
Downloading Untitled.png
Downloaded successfully downloaded "Untitled.png" -> "efa249c0.png"
Downloading Untitled.png
Downloaded successfully downloaded "Untitled.png" -> "655d25f0.png"
Downloading Untitled.png
Downloading Untitled.png
Downloaded successfully downloaded "Untitled.png" -> "89499899.png"
Downloading Untitled.png
Downloaded successfully downloaded "Untitled.png" -> "7da913a6.png"
Downloading Untitled.png
Downloading Untitled.png
Downloading Untitled.png
Downloading Untitled.png
Downloaded successfully downloaded "Untitled.png" -> "622b79c5.png"
Downloaded successfully downloaded "Untitled.png" -> "af36b02a.png"
Downloading Untitled.png
Downloading Untitled.png
Downloaded successfully downloaded "Untitled.png" -> "c801458a.png"
Downloading Untitled.png
Downloaded successfully downloaded "Untitled.png" -> "0232f3c2.png"
Downloading Untitled.png
Downloaded successfully downloaded "Untitled.png" -> "cc5ff237.png"
ERROR unvalid
Downloaded successfully downloaded "Untitled.png" -> "1116e8d7.png"
Downloaded successfully downloaded "Untitled.png" -> "4ce7a0c0.png"
Downloaded successfully downloaded "Untitled.png" -> "d8a12515.png"
Downloading Untitled.png
Downloading Untitled.png
Downloading Untitled.png
Downloaded successfully downloaded "Untitled.png" -> "55ee9379.png"
Downloaded successfully downloaded "Untitled.png" -> "b4350bc1.png"
Downloading Untitled.png
Downloaded successfully downloaded "Untitled.png" -> "c55c20e2.png"
Downloading Untitled.png
Downloaded successfully downloaded "Untitled.png" -> "e340ea99.png"
Downloaded successfully downloaded "Untitled.png" -> "6124a7aa.png"
Downloading Untitled.png
Downloaded successfully downloaded "Untitled.png" -> "ce8bc3e6.png"
Downloading Untitled.png
Downloaded successfully downloaded "Untitled.png" -> "ea18df57.png"
Downloaded successfully downloaded "Untitled.png" -> "fd9b1112.png"
Traceback (most recent call last):
File "/opt/anaconda3/envs/notioner/bin/notion2md", line 8, in
sys.exit(run())
File "/opt/anaconda3/envs/notioner/lib/python3.9/site-packages/notion2md/cli.py", line 41, in run
target_type_mapargs['type']
File "/opt/anaconda3/envs/notioner/lib/python3.9/site-packages/notion2md/exporter.py", line 26, in block_markdown_exporter
output.write(blocks_convertor(blocks))
File "/opt/anaconda3/envs/notioner/lib/python3.9/site-packages/notion2md/convertor/block.py", line 136, in blocks_convertor
outcome_blocks = "".join([result for result in results])
File "/opt/anaconda3/envs/notioner/lib/python3.9/site-packages/notion2md/convertor/block.py", line 136, in
outcome_blocks = "".join([result for result in results])
File "/opt/anaconda3/envs/notioner/lib/python3.9/concurrent/futures/_base.py", line 608, in result_iterator
yield fs.pop().result()
File "/opt/anaconda3/envs/notioner/lib/python3.9/concurrent/futures/_base.py", line 445, in result
return self.__get_result()
File "/opt/anaconda3/envs/notioner/lib/python3.9/concurrent/futures/_base.py", line 390, in __get_result
raise self._exception
File "/opt/anaconda3/envs/notioner/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/opt/anaconda3/envs/notioner/lib/python3.9/site-packages/notion2md/convertor/block.py", line 202, in block_convertor
outcome_block += "\t"*depth + block_convertor(block,depth)
File "/opt/anaconda3/envs/notioner/lib/python3.9/site-packages/notion2md/convertor/block.py", line 202, in block_convertor
outcome_block += "\t"*depth + block_convertor(block,depth)
File "/opt/anaconda3/envs/notioner/lib/python3.9/site-packages/notion2md/convertor/block.py", line 176, in block_convertor
outcome_block = block_type_mapblock_type + "\n\n"
File "/opt/anaconda3/envs/notioner/lib/python3.9/site-packages/notion2md/convertor/block.py", line 67, in image
name,file_path = downloader(information['url'])
TypeError: cannot unpack non-iterable NoneType object

Returning empty markdown files

Having a bit of an issue getting the generated markdown files to work. I followed the example in the readme, and added my API key to an environment variable:

from notion2md.exporter.block import MarkdownExporter
from dotenv import load_dotenv
load_dotenv()
MarkdownExporter(block_id='my_block_id',output_path='test.md',download=True).export()

In this case, I'm getting the page directory generated, but the .md file inside is unfortunately empty. Do you know what could be causing this?

For reference, I'm using Python 3.9.13 and these Notion libraries:

notion-client==1.0.0
notion2md==2.7.6

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.