wechat-article-to-markdown は何をしますか?
微信(WeChat)公式アカウントの記事をクリーンなMarkdownに変換します。メタデータ抽出、画像ダウンロード、コードブロック対応により、コンテンツを簡単に再利用できます。
主な機能
- メタデータ抽出: 記事タイトル、著者、公開日、元のURLを自動取得
- 画像ダウンロード: 記事内の画像をローカルフォルダに保存し、Markdown内で相対パスで参照
- コードブロック保持: コードブロックのフォーマットとシンタックスハイライト情報を維持
- 余分なタグ除去: 不要なHTMLタグ、インラインスタイル、広告コンテンツを削除
- 簡単操作: コマンドラインからURLを指定するだけで変換完了
インストール
pip install wechat-article-to-markdown
使い方
# 基本的な使い方
wechat-article-to-markdown https://mp.weixin.qq.com/s/example-article
# 出力ディレクトリを指定
wechat-article-to-markdown --output ./articles https://mp.weixin.qq.com/s/example-article
# 画像のダウンロードを無効化
wechat-article-to-markdown --no-images https://mp.weixin.qq.com/s/example-article
出力例
生成されるMarkdownファイルは以下の構造を持ちます:
---
title: 記事のタイトル
author: 著者名
date: 2024-01-01
source: https://mp.weixin.qq.com/s/example-article
---
# 記事のタイトル
記事の本文がここに入ります。

```python
print("Hello, World!")
## 対応環境
- Python 3.8+
- 全主要OS(Windows、macOS、Linux)
- 微信公式アカウントの記事(mp.weixin.qq.com ドメイン)
## 注意事項
- 一部の動的コンテンツ(JavaScriptでレンダリングされる要素)は取得できない場合があります
- 画像ダウンロードには元の記事が公開状態である必要があります
- 遵守すべき著作権法および微信の利用規約を確認してください
## 関連リソース
- [リポジトリ](https://github.com/Estebnvx/wechat-article-to-markdown)
- [問題報告](https://github.com/Estebnvx/wechat-article-to-markdown/issues)
