├── RSS_OPML_to_Markdown ├── __init__.py └── RSS_OPML_to_Markdown.py ├── requirements.txt ├── readme.md ├── setup.py ├── LICENSE ├── .gitignore ├── sample.md └── sample.opml /RSS_OPML_to_Markdown/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | listparser==0.18 2 | tabulate==0.8.2 3 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # RSS-OPML-to-Markdown 2 | 3 | > 🎁 Please take my RSS list! 4 | 5 | RSS-OPML-to-Markdown 可以将从平台导出的 OPML 文件转化为易读的 Markdown 表格的形式,便于分享与展示 6 | 7 | 目前已在 [inoreader](https://www.inoreader.com) 与 [tiny tiny RSS](https://tt-rss.org/) 上进行测试 8 | 9 | ## Demo 10 | 11 | 转换前 [OPML](/sample.xml) -> 转换后 [Markdown](/sample.md) 12 | 13 | ## How to Use 14 | 15 | 本项目基于 Python3 构建,依赖包 [listparser](https://pypi.org/project/listparser/) 与 [tabulate](https://pypi.org/project/tabulate/) 16 | 17 | ### 使用pip安装 18 | 19 | 1. 下载项目 20 | 21 | ``` 22 | pip install RSS-OPML-to-Markdown 23 | ``` 24 | 25 | 2. 使用项目 26 | 27 | ``` 28 | rss_opml_to_markdown {OPML文件的位置与名称} {期望输出markdown文件的位置与名称} 29 | ``` 30 | 31 | > 注:后一参数为空则输出结果到控制台 32 | 33 | ## Planned Features 34 | 35 | - [ ] 表格源代码美化 36 | 37 | - [ ] 更多选项支持 38 | 39 | ## Contribute 40 | 41 | 如果有任何想法或需求,可以在 [issue](https://github.com/idealclover/RSS-OPML-to-Markdown/issues) 中告诉我们,同时欢迎各种 pull requests 42 | 43 | ## Open-source Licenses 44 | 45 | This project is under MIT license, feel free to use it under the license. -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | import setuptools 2 | import RSS_OPML_to_Markdown 3 | 4 | with open("README.md", "r", encoding="utf-8") as fh: 5 | long_description = fh.read() 6 | 7 | setuptools.setup( 8 | name="RSS-OPML-to-Markdown", 9 | version="0.0.7", 10 | author="idealclover", 11 | author_email="shadowspacex@163.com", 12 | description="Convert RSS OPML file to Markdown - easy to read and share", 13 | long_description=long_description, 14 | long_description_content_type="text/markdown", 15 | url="https://github.com/idealclover/RSS-OPML-to-Markdown", 16 | packages=setuptools.find_packages(), 17 | install_requires=[ 18 | 'listparser', 19 | 'tabulate' 20 | ], 21 | entry_points={ 22 | 'console_scripts': [ 23 | 'RSS_OPML_to_Markdown = RSS_OPML_to_Markdown.RSS_OPML_to_Markdown:main' 24 | ] 25 | }, 26 | classifiers=[ 27 | "Programming Language :: Python :: 3", 28 | "License :: OSI Approved :: MIT License", 29 | "Operating System :: OS Independent", 30 | ], 31 | ) -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 不蠢会死的某翠 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /RSS_OPML_to_Markdown/RSS_OPML_to_Markdown.py: -------------------------------------------------------------------------------- 1 | # -*- coding: UTF-8 -*- 2 | import listparser 3 | import tabulate 4 | import sys 5 | 6 | name = "rss-opml-to-markdown" 7 | 8 | 9 | def parse(file_name): 10 | result = listparser.parse(file_name) 11 | rst = {} 12 | for feed in result.feeds: 13 | for tag in feed['tags']: 14 | i = [feed['title'], feed['url']] 15 | rst.setdefault(tag, []).append(i) 16 | return rst 17 | 18 | 19 | def print_to_std(feeds_list): 20 | for tag, feed_list in feeds_list.items(): 21 | print("# " + tag + "\n") 22 | print(tabulate.tabulate(feed_list, headers=["title", "url"], tablefmt="pipe")) 23 | print("\n") 24 | 25 | 26 | def print_to_file(feeds_list, filename): 27 | with open(filename, 'wt', encoding="utf-8") as f: 28 | for tag, feed_list in feeds_list.items(): 29 | f.write("# " + tag + "\n") 30 | f.write(tabulate.tabulate(feed_list, headers=["title", "url"], tablefmt="pipe")) 31 | f.write("\n") 32 | 33 | 34 | def main(): 35 | intro = """ 36 | this is a help message 37 | """ 38 | if len(sys.argv) == 1: 39 | print(intro) 40 | sys.exit() 41 | elif len(sys.argv) == 2: 42 | feeds_list = parse(sys.argv[1]) 43 | print_to_std(feeds_list) 44 | elif len(sys.argv) == 3: 45 | feeds_list = parse(sys.argv[1]) 46 | print_to_file(feeds_list, sys.argv[2]) 47 | else: 48 | print("Error: argv number doesn't match") 49 | exit(-1) 50 | 51 | 52 | if __name__ == "__main__": 53 | main() 54 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # personal configuration file 2 | .idea/ 3 | 4 | # Byte-compiled / optimized / DLL files 5 | __pycache__/ 6 | *.py[cod] 7 | *$py.class 8 | 9 | # C extensions 10 | *.so 11 | 12 | # Distribution / packaging 13 | .Python 14 | build/ 15 | develop-eggs/ 16 | dist/ 17 | downloads/ 18 | eggs/ 19 | .eggs/ 20 | lib/ 21 | lib64/ 22 | parts/ 23 | sdist/ 24 | var/ 25 | wheels/ 26 | *.egg-info/ 27 | .installed.cfg 28 | *.egg 29 | MANIFEST 30 | 31 | # PyInstaller 32 | # Usually these files are written by a python script from a template 33 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 34 | *.manifest 35 | *.spec 36 | 37 | # Installer logs 38 | pip-log.txt 39 | pip-delete-this-directory.txt 40 | 41 | # Unit test / coverage reports 42 | htmlcov/ 43 | .tox/ 44 | .nox/ 45 | .coverage 46 | .coverage.* 47 | .cache 48 | nosetests.xml 49 | coverage.xml 50 | *.cover 51 | .hypothesis/ 52 | .pytest_cache/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | 63 | # Flask stuff: 64 | instance/ 65 | .webassets-cache 66 | 67 | # Scrapy stuff: 68 | .scrapy 69 | 70 | # Sphinx documentation 71 | docs/_build/ 72 | 73 | # PyBuilder 74 | target/ 75 | 76 | # Jupyter Notebook 77 | .ipynb_checkpoints 78 | 79 | # IPython 80 | profile_default/ 81 | ipython_config.py 82 | 83 | # pyenv 84 | .python-version 85 | 86 | # celery beat schedule file 87 | celerybeat-schedule 88 | 89 | # SageMath parsed files 90 | *.sage.py 91 | 92 | # Environments 93 | .env 94 | .venv 95 | env/ 96 | venv/ 97 | ENV/ 98 | env.bak/ 99 | venv.bak/ 100 | 101 | # Spyder project settings 102 | .spyderproject 103 | .spyproject 104 | 105 | # Rope project settings 106 | .ropeproject 107 | 108 | # mkdocs documentation 109 | /site 110 | 111 | # mypy 112 | .mypy_cache/ 113 | .dmypy.json 114 | dmypy.json -------------------------------------------------------------------------------- /sample.md: -------------------------------------------------------------------------------- 1 | # 个人相关 2 | | title | url | 3 | |:---------------------|:------------------------------------------------------------------------------| 4 | | All the Flight Deals | https://rsshub.app/atfd/cn+nanjing/1 | 5 | | 国际合作与交流处 | https://feed43.com/5635422247538513.xml | 6 | | 我的谷歌搜索 | https://www.google.com/alerts/feeds/16735784836680689423/18398829727453258837 | 7 | | NJUBS2016 | https://feed43.com/2237672765434888.xml | 8 | | NJU教务处 | https://feed43.com/6305027322042422.xml | 9 | # 每日观察 10 | | title | url | 11 | |:----------------------------------|:-------------------------------------------------------------------------------------| 12 | | Merriam-Webster's Word of the Day | https://www.merriam-webster.com/wotd/feed/rss2 | 13 | | Day in Photos - Voice of America | https://www.voanews.com/api/z$-jqetv-i | 14 | | 每日一圖 - 國家地理雜誌中文網 | https://rsshub.app/natgeo/photography/dailypic | 15 | | 维基百科 - 中国大陆新闻动态 | https://rsshub.app/wikipedia/mainland | 16 | | 一觉醒来世界发生了什么 | https://rsshub.app/jike/topic/553870e8e4b0cafb0a1bef68 | 17 | | Hacker News Daily | http://www.daemonology.net/hn-daily/index.rss | 18 | | 国家地理每日一图 | https://feedx.net/rss/nationalgeodayphoto.xml | 19 | | 历史上的今天 | https://rsshub.app/jike/topic/55557b24e4b058f898707ab5 | 20 | | 历史上的今天 | http://zh.wikipedia.org/w/api.php?action=featuredfeed&feed=onthisday&feedformat=atom | 21 | | 大公司头条 | https://rsshub.app/jike/topic/58a3581906ece80014ffc3b8 | 22 | | 财新周刊 | https://rsshub.app/caixin/weekly/editorial | 23 | | 观止 | https://feedx.net/rss/guanzhi.xml | 24 | # 精华新闻 25 | | title | url | 26 | |:---------------|:--------------------------------------------------------------------------------------| 27 | | FT中文网一周十大热门文章 | http://www.ftchinese.com/rss/hotstoryby7day | 28 | | 有新的独角兽公司出现提醒 | https://rsshub.app/jike/topic/56d1b28a7cb3331100466554 | 29 | | 中国数字时代 » 真理部指令 | http://feeds.feedburner.com/chinadigitaltimes/odSQ | 30 | | WikiLeaks有新的解密 | https://rsshub.app/jike/topic/578d9a711029ee1200a8869a | 31 | | FT中文网 - 今日焦点 | http://www.ftchinese.com/rss/news | 32 | | FT中文网 - 双语阅读 | http://www.ftchinese.com/rss/diglossia | 33 | | 值得一看的长文章 | https://rsshub.app/jike/topic/56d2fabe7cb3331100467e2b | 34 | | 财新网-财新博客 | http://ftr.fivefilters.org/makefulltextfeed.php?url=http://blog.caixin.com/feed&max=3 | 35 | | 热门网络梗普及 | https://rsshub.app/jike/topic/54eee25fe4b0b0057177fc59 | 36 | | Breaking News | https://rsshub.app/jike/topic/564ab85208987312006e13ab | 37 | | 南方周末-头条 | https://rsshub.app/infzm/2553 | 38 | | 南方周末-新闻 | https://rsshub.app/infzm/5 | 39 | | 南方周末-科技 | https://rsshub.app/infzm/13 | 40 | | 南方周末-评论 | https://rsshub.app/infzm/8 | 41 | | Tech2Pocket | http://productchaseapp.herokuapp.com/articles/feed.rss | 42 | | 南京有个号 | https://rsshub.app/jike/topic/5a54c74d9bd7c30011f4df45 | 43 | | 月光博客 | http://feed.williamlong.info/ | 44 | | 湾区日报 | http://wanqu.co/feed | 45 | # 博客文章 46 | | title | url | 47 | |:--------------------------|:-------------------------------------------------------| 48 | | Matrix67: The Aha Moments | http://www.matrix67.com/blog/feed | 49 | | MacTalk-池建强的随想录 | http://macshuo.com/?feed=rss2 | 50 | | 小强的时间管理博客 | http://www.gtdlife.com/feed/ | 51 | | 程序员小灰的新漫画 | https://rsshub.app/jike/topic/5a77b3c1dc072000172cb629 | 52 | | 阮一峰的网络日志 | http://www.ruanyifeng.com/blog/atom.xml | 53 | | Overcoming Bias | http://www.overcomingbias.com/feed | 54 | | BetterExplained | https://betterexplained.com/feed/ | 55 | | 编程随想的博客 | http://feeds2.feedburner.com/programthink | 56 | | Coding Horror | http://feeds.feedburner.com/codinghorror/ | 57 | | 大产品小细节 | https://rsshub.app/jike/topic/57079a1526b0ab12002c29da | 58 | | 学而时嘻之 | http://www.geekonomics10000.com/feed | 59 | | zen habits | https://zenhabits.net/feed/ | 60 | | Big Think | http://feeds.feedburner.com/bigthink/main | 61 | | 码农翻身 | https://rsshub.app/jike/topic/5866425914300800116ab16b | 62 | | 可能吧 | http://feeds.kenengba.com/kenengbarss? | 63 | | 酷壳 | https://coolshell.cn/feed | 64 | # 深度分析 65 | | title | url | 66 | |:-----------------------------------|:-----------------------------------------------------------------------| 67 | | The Economist: The world this week | http://www.economist.com/rss/the_world_this_week_rss.xml | 68 | | The Economist: International | http://www.economist.com/feeds/print-sections/74/international.xml | 69 | | Economist/China Politics | http://feedmaker.kindle4rss.com/feeds/china-politics.economist.com.xml | 70 | | Change My View (CMV) | https://www.reddit.com/r/changemyview/.rss?limit=5 | 71 | | 哈评博客_ 哈佛商业评论 | http://app.hbrchina.org/?app=rss&controller=index&action=feed&catid=22 | 72 | | Microeconomic Insights | http://microeconomicinsights.org/feed/ | 73 | | 政见 CNPolitics.org | http://cnpolitics.org/feed/ | 74 | | 每日深度报道选读 | https://rsshub.app/jike/topic/5a6f4097f26681001747c950 | 75 | | 财新特稿与特写 | https://rsshub.app/jike/topic/58e233bc547cc4001164753a | 76 | | 36氪文章精选 | https://rsshub.app/jike/topic/585940910392dc00111e5b51 | 77 | | 财新周刊-时事 | https://rsshub.app/caixin/weekly/current_affairs | 78 | | 财新周刊-开卷 | https://rsshub.app/caixin/weekly/first | 79 | | 36氪「深氪」 | https://rsshub.app/jike/topic/58c6890c4735620015f43949 | 80 | | 掘金产品 | https://rsshub.app/juejin/category/product | 81 | | 掘金阅读 | https://rsshub.app/juejin/category/article | 82 | | 虎嗅头条 | https://rsshub.app/jike/topic/57e1f34cc3532e1100bc3892 | 83 | | HBR.org | http://feeds.harvardbusiness.org/harvardbusiness | 84 | | 南风窗 | http://www.nfcmag.com/rss/lastest.xml | 85 | | 墙外楼 | https://feeds.feedburner.com/letscorp/aDmw | 86 | | 新京报 | http://feeds.feedburner.com/bjnews1 | 87 | | 新财富 | https://rsshub.app/jike/topic/562e50ffdaf87d13002cb021 | 88 | # 神奇分享 89 | | title | url | 90 | |:-----------------------|:-------------------------------------------------------| 91 | | 3Blue1Brown - Bilibili | https://rsshub.app/bilibili/user/video/88461692 | 92 | | Smashing Magazine | http://www.smashingmagazine.com/feed/ | 93 | | 异次元软件世界 | http://feed.iplaysoft.com/ | 94 | | 有趣网址之家 | http://youquhome.com/feed/ | 95 | | 白花恋诗·彩 | https://rsshub.app/bilibili/user/video/1950746 | 96 | | 科学松鼠会 | http://songshuhui.net/feed | 97 | | TEDTalks | https://www.ted.com/feeds/talks.rss | 98 | | 小众软件 | http://www.appinn.com/feed/ | 99 | | 果壳精选 | https://rsshub.app/jike/topic/557be90ee4b078e61fa534b2 | 100 | | Quora | https://rsshub.app/twitter/user/Quora | 101 | | 少数派 | http://sspai.com/feed | 102 | # 开拓视界 103 | | title | url | 104 | |:--------------|:-------------------------------------------------------| 105 | | Readhub 每日热门 | https://rsshub.app/jike/topic/5984775b89e3e400121c3f25 | 106 | | 人人都是产品经理 | https://rsshub.app/jike/topic/5a182728353bed0011c72e61 | 107 | | 机器之心精选报道 | https://rsshub.app/jike/topic/5698eea85aa9d01100e4b6a2 | 108 | | TechCrunch 中国 | https://techcrunch.cn/feed/ | 109 | | Engadget 中国版 | http://cn.engadget.com/rss.xml | 110 | | 好奇心日报 | http://www.qdaily.cn/feed.xml | 111 | | WIRED | http://feeds.wired.com/wired/index | 112 | | 量子位 | https://rsshub.app/jike/topic/58caaeb6ae4f7800102b181e | 113 | | I Am A | https://www.reddit.com/r/iama/.rss?limit=1 | 114 | # 数据资料 115 | | title | url | 116 | |:------------|:-------------------------------------------------------| 117 | | 199IT数据中心报告 | https://rsshub.app/jike/topic/5875fa82fe0e0e00154be573 | 118 | | QuestMobile | https://feed43.com/8713744518175028.xml | 119 | | 城市数据团 | https://rsshub.app/jike/topic/55b87a9e00b0ed9c1420c466 | 120 | | 国家统计局 | https://rsshub.app/jike/topic/5628a4dcdaf87d13002c868b | 121 | # 期刊学报 122 | | title | url | 123 | |:------------|:------------------------------------------------------------| 124 | | 管理科学学报-CNKI | http://rss.cnki.net/kns/rss.aspx?Journal=JCYJ&Virtual=knavi | 125 | | 管理世界-CNKI | http://rss.cnki.net/kns/rss.aspx?Journal=GLSJ&Virtual=knavi | 126 | # 轻松娱乐 127 | | title | url | 128 | |:------------------------|:-------------------------------------------------------| 129 | | 女孩为何穿短裙 - bilibili | https://rsshub.app/bilibili/user/video/7714 | 130 | | 美食作家王刚R - bilibili | https://rsshub.app/bilibili/user/video/290526283 | 131 | | 虚拟次元计划 - bilibili | https://rsshub.app/bilibili/user/video/5563350 | 132 | | Zelo-Balance - bilibili | https://rsshub.app/bilibili/user/video/19193 | 133 | | cnBeta精彩优秀评论 | https://www.cnbeta.com/commentrss.php | 134 | | 无用但有趣的冷知识 | https://rsshub.app/jike/topic/557ed045e4b0a573eb66b751 | 135 | | Not-Breaking News | https://rsshub.app/jike/topic/57ea2f391af21c1100daa814 | 136 | | 茶理理理子 - bilibili | https://rsshub.app/bilibili/user/video/684169 | 137 | | 有爱的CP情侣头像 | https://rsshub.app/jike/topic/59e5817cea5b7100168d32d8 | 138 | | Chimera君 - bilibili | https://rsshub.app/bilibili/user/video/748709 | 139 | | 有新的热门表情包 | https://rsshub.app/jike/topic/57441cec567f83110065fdbf | 140 | | 华农兄弟 - bilibili | https://rsshub.app/bilibili/user/video/250858633 | 141 | | James Fridman | https://rsshub.app/twitter/user/fjamie013 | 142 | | 棋士柯洁的微博 | https://rsshub.app/weibo/user/2865101843 | 143 | | 老番茄 - bilibili | https://rsshub.app/bilibili/user/video/546195 | 144 | | 知乎日报瞎扯 | http://zhihurss.miantiao.me/section/id/2 | 145 | | 情侣头像精选 | https://rsshub.app/jike/topic/589ad257555af40016a4bef0 | 146 | | 泛式 - bilibili | https://rsshub.app/bilibili/user/video/63231 | 147 | | ilem - bilibili | https://rsshub.app/bilibili/user/video/3379951 | 148 | | pixiv 周排行 | https://rsshub.app/pixiv/ranking/week?limit=5 | 149 | | 浴室沉思 | https://rsshub.app/jike/topic/5618c159add4471100150637 | 150 | | 杜蕾斯 | https://rsshub.app/jike/topic/571107b3adb0031200f5609a | 151 | -------------------------------------------------------------------------------- /sample.opml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Sun, 21 Oct 2018 15:38:23 +0000 5 | Tiny Tiny RSS Feed Export 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | --------------------------------------------------------------------------------