mirror of
https://github.com/bnchiang96/xiaohongshu-importer.git
synced 2026-07-22 05:42:21 +00:00
No description
| .editorconfig | ||
| .eslintignore | ||
| .eslintrc | ||
| .gitignore | ||
| .npmrc | ||
| esbuild.config.mjs | ||
| LICENSE | ||
| main.ts | ||
| manifest.json | ||
| package.json | ||
| README.md | ||
| styles.css | ||
| tsconfig.json | ||
| version-bump.mjs | ||
| versions.json | ||
| yarn.lock | ||
Xiaohongshu Importer for Obsidian
Import notes from Xiaohongshu (小红书) into your Obsidian vault with ease. This plugin extracts titles, content, images, videos, and tags from Xiaohongshu share links, organizing them into neatly formatted Markdown files.
Features
- Import Notes: Paste a Xiaohongshu share link (e.g.,
http://xhslink.com/a/...) to import its content. - Media Handling:
- Option to download images and videos locally to a
mediasubfolder (e.g.,XHS Notes/media/). - Uses relative paths (
../media/) for local media or online URLs if downloading is disabled.
- Option to download images and videos locally to a
- Video Support: Embeds videos with
<video>tags for video notes, falling back to a cover image if the video URL is unavailable. - Content Extraction: Pulls titles, descriptions, and tags from notes, cleaning up hashtags and formatting them in a code block.
- Categorization: Assign notes to user-defined categories via a chip-based selection UI in the import modal.
- Flexible Storage:
- Configurable base folder (default:
XHS Notes). - Notes are saved in category subfolders (e.g.,
XHS Notes/搞笑/[V]Note-Title.mdfor video notes).
- Configurable base folder (default:
- Settings:
- Set a default folder for imports.
- Toggle default media download behavior (overridable per import).
- Manage a list of categories with add/edit/remove and reorder functionality.
- Frontmatter: Adds metadata (title, source URL, date, imported timestamp, category) to each note.
Installation
Manual Installation
- Clone or Download:
- Clone this repository or download the ZIP file:
git clone https://github.com/yourusername/xhs-importer.git - Or download from the releases page (once published).
- Clone this repository or download the ZIP file:
- Copy Files:
- Copy
main.js,manifest.json, and (optionally)styles.cssto your vault’s plugin folder:cp main.js manifest.json /path/to/your-vault/.obsidian/plugins/xhs-importer/ - If the
xhs-importerfolder doesn’t exist, create it first:mkdir /path/to/your-vault/.obsidian/plugins/xhs-importer
- Copy
- Enable Plugin:
- Open Obsidian, go to
Settings > Community Plugins. - Ensure "Safe Mode" is off.
- Find "Xiaohongshu Importer" in the list and toggle it on.
- Open Obsidian, go to
Development Setup (Optional)
For those who want to modify or build the plugin:
- Install Dependencies:
- Ensure Node.js and Yarn are installed.
- Run:
yarn install
- Build:
- Compile the TypeScript code:
yarn dev - Copy the output (
main.js) andmanifest.jsonto your plugin folder as above.
- Compile the TypeScript code:
- Hot Reload (Optional):
- Install the Obsidian Hot Reload plugin.
- Use
yarn devto watch for changes and auto-reload in Obsidian.
Usage
- Trigger Import:
- Click the ribbon icon (book) on the left sidebar, or use the command
Import Xiaohongshu Notevia the Command Palette (Ctrl/Cmd + P).
- Click the ribbon icon (book) on the left sidebar, or use the command
- Enter Share Text:
- Paste the Xiaohongshu share text containing the URL (e.g., "64 不叫小黄了发布了一篇小红书笔记,快来看看吧!http://xhslink.com/a/...").
- Select Options:
- Choose a category from the list.
- Check "Download media locally for this import" to override the default setting.
- Import:
- Click "Import" or press Enter to process the note.
- The note will be created and opened in a new tab.
Configuration
- Open
Settings > Community Plugins > Xiaohongshu Importer:- Default Folder: Set where notes and media are saved (e.g.,
XHS Notes). - Download Media: Toggle default behavior for downloading media (overridable per import).
- Categories: Add, edit, remove, or reorder categories for organizing notes.
- Default Folder: Set where notes and media are saved (e.g.,
Example Output
For a note with title 柔佛人狂喜!新山终于有“地铁”了?:
- File:
XHS Notes/搞笑/柔佛人狂喜!新山终于有“地铁”了?.md - Content:
#tags here--- title: 柔佛人狂喜!新山终于有“地铁”了? source: http://xhslink.com/a/... date: 2025-03-09 Imported At: 3/9/2025, 2:35:22 PM category: 搞笑 --- # 柔佛人狂喜!新山终于有“地铁”了?  [Note content here] - Media:
XHS Notes/media/柔佛人狂喜-新山终于有地铁了-cover-1741570701965.jpg
Contributing
Feel free to submit issues or pull requests on GitHub. To build locally:
- Clone the repo.
- Run
yarn installandyarn dev. - Test in your Obsidian vault.
License
MIT License - see LICENSE for details.
Acknowledgements
Built with ❤️ for the Obsidian community, powered by xAI's Grok.