Language: English | 简体中文
Back up your own notes from Huawei Cloud (cloud.huawei.com) and export them to TXT / Markdown / HTML / JSON / PDF (pick any formats you like).
Pure Python, minimal dependencies, works out of the box. Ideal for switching phones, migrating notes, or archiving your memos locally.
- 📥 Fetch all notes + to-dos from Huawei Cloud (title, body, created/modified time, category, favorite)
- 🖼️ Auto-downloads original images and preserves the original text/image order inside each note
- 🧩 Export to multiple formats, freely selectable at export time:
json— structured data (notes + to-dos + categories, including raw fields) for further processingtxt/md— one file per note, organized into folders by category; each file's created/modified timestamps are set to the note's original times, so you can sort by time directly in your file managerhtml— the notes page has sort buttons (by created / modified time, ascending or descending), the to-do page can toggle the original order; images inlinedpdf— mixed text/images, Times-Roman for English + a built-in CJK font for Chinese;notes.pdfbuilds a bookmark outline from titles and is ordered by modified time (newest first)
- 🔐 Authenticated via your browser login cookie; all data is processed locally and never uploaded to any third party
Requires Python 3.9+.
git clone https://github.com/<your-name>/HuaweiMemoBackup.git
cd HuaweiMemoBackup
pip install -r requirements.txtIf PyPI is slow in your region, use a mirror, e.g.:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt
Huawei Cloud has no public export API, so this tool reuses your existing browser login. Follow these steps to grab the cookie:
- On your phone, enable Notes cloud sync: Settings → Huawei ID → Cloud → turn on the "Notepad" sync switch, and wait for it to finish.
- Open https://cloud.huawei.com in a desktop browser, log in, open Notepad, and confirm you can see your notes.
- Press
F12to open DevTools and switch to the Network tab. - Click any note on the page to trigger a request; in the request list find one like
simplenote/queryornote/query. - Click that request → Headers → find the
Cookie:field under Request Headers and copy its entire long value. - Save it into a text file (e.g.
cookie.txt, a single line), then run with--cookie-file cookie.txt.
💡 The cookie is long, so reading it from a file with
--cookie-file cookie.txtis usually more reliable than pasting it directly in a terminal (some terminals wrap/truncate very long strings). Both ways work though — the tool automatically trims stray whitespace introduced when pasting.
⚠️ A cookie is equivalent to your login credentials. Do not share it or commit it to a repo (cookie.txtis already in.gitignore). Cookies expire; just copy a fresh one when it stops working.
Just run it, then follow the prompts to choose formats and paste the cookie:
python -m huawei_memo_backup# Export Markdown, HTML and PDF into the output directory
python -m huawei_memo_backup --cookie "PASTE_YOUR_COOKIE" -f md html pdf
# Read the cookie from a file and export all formats
python -m huawei_memo_backup --cookie-file cookie.txtCopy config.example.json to config.json and fill in your cookie:
{
"cookie": "YOUR_COOKIE",
"output_dir": "output",
"formats": ["json", "md", "html", "txt", "pdf"],
"download_attachments": true,
"request_interval": 0.5,
"pdf_font": ""
}Then run:
python -m huawei_memo_backup --config config.json -y| Option | Description |
|---|---|
--cookie |
Pass the cookie string directly |
--cookie-file |
Read the cookie from a file |
--config |
Path to a JSON config file |
-f, --format |
Formats to export (multiple allowed): json txt md html pdf |
-o, --output |
Output directory (default: output) |
--no-attachments |
Do not download image attachments |
--no-todos |
Do not export to-dos |
--interval |
Seconds between detail requests (default 0.5) to avoid hammering the server |
--pdf-font |
Custom CJK font for PDF (path to a TTF); uses the built-in font if omitted |
-y, --yes |
Non-interactive mode, no prompts |
-v, --verbose |
Verbose debug logging |
You can also provide the cookie via the HUAWEI_CLOUD_COOKIE environment variable.
output/
├── attachments/ # Downloaded original images/attachments (shared by all formats)
│ └── some-note_1.jpg
├── json/
│ └── notes.json # Structured data: notes + to-dos + categories (all together)
├── html/
│ ├── notes.html # Notes, single page (index + inline images)
│ └── 待办清单.html # To-dos on their own page
├── pdf/
│ ├── notes.pdf # Notes PDF (mixed text/images)
│ └── 待办清单.pdf # To-dos as a separate PDF
├── md/
│ ├── <category>/some-note.md # One md per note, foldered by category ("未分类" if none)
│ └── 待办清单.md # To-dos live at the md/ root
└── txt/
├── <category>/some-note.txt
└── 待办清单.txt
- json: notes and to-dos are kept together in one file.
- html / pdf: notes and to-dos are split into two separate files.
- md / txt: each note is filed under
md/<category>/ortxt/<category>/based on its Huawei Notepad category; the to-do list sits at the root ofmd/andtxt/.
The tool calls Huawei Cloud's internal APIs (a login cookie is required):
| Purpose | Endpoint |
|---|---|
| List (notes + to-dos) | POST /notepad/simplenote/query → noteList / taskList / startCursor |
| Categories | POST /notepad/notetag/query |
| Note detail | POST /notepad/note/query (needs guid + the note's kind + startCursor) |
| Image download | GET /proxy/v1/download/<encoded-path> (built from the assetId/versionId in the detail) |
- The list endpoint returns all notes and to-dos at once; each note carries a
kind(note= legacy,newnote= new format). - The detail endpoint returns the body
html_content(an<element type="Text"/Attachment">structure where Chinese appears as&#xxxxx;numeric entities) plus attachment metadata. - The parser rebuilds text/image order from the elements; images are downloaded via
/proxy/v1/download.
These are Huawei's undocumented private APIs and may change at any time. If fetching fails, it's most likely an expired cookie or an API change. Try
-f json -vfirst and inspect the raw fields (raw_summary/raw_detail) innotes.json.
- "Response is not JSON / cookie invalid": log in again on the web and copy a fresh cookie.
- No notes at all: make sure Notepad cloud sync is enabled and finished on your phone, and you can see the notes on the web.
- Chinese not showing in PDF: a built-in reportlab CJK font is used; if issues persist, pass
--pdf-fontwith a local CJK TTF (e.g.C:\Windows\Fonts\msyh.ttcon Windows). - Image download returns 403: the login session has expired (image download goes through the stricter
/proxytoken service). Log in again on cloud.huawei.com and copy a fresh cookie. - Some images didn't download: handwritten/graffiti notes download their rendered
graffiti.jpg; attachments missingassetId/versionIdare skipped but their filenames are kept — check the raw attachment info innotes.json.
This tool is intended only for backing up data under your own Huawei account. Do not use it in any way that violates others' privacy or Huawei's terms of service. You assume all risk arising from its use.
The API structure was independently verified against a real account by this project; early ideas were informed by the community projects formero009/huawei_note_downloader and thsrite/huawei_note_to_xiaomi_note.