summary refs log tree commit diff
diff options
context:
space:
mode:
authorNguyễn Gia Phong <mcsinyx@disroot.org>2021-10-14 21:15:12 +0700
committerNguyễn Gia Phong <mcsinyx@disroot.org>2021-10-14 21:15:12 +0700
commit23a182879c30fa09fa28f4e57ec913559d787e81 (patch)
tree68c6538e0e3f4a8b3151b12fd1836ad58bd10708
parent2f50663bc527fd2c10e60ca9764e7b0728c97422 (diff)
downloadrsskey-0.1.0.tar.gz
Add basic documentation 0.1.0
-rw-r--r--README.md63
-rw-r--r--pyproject.toml15
-rwxr-xr-xsrc/rsskey.py5
3 files changed, 72 insertions, 11 deletions
diff --git a/README.md b/README.md
index e56fd12..c463fcf 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,64 @@
 # rsskey
 
-RSS feed mirror on Misskey
+rsskey is a simple script for mirroring [RSS] or [Atom] feeds on [Misskey].
+It splits original posts into paragraphs or sentences to fit an instance's
+character limit and checks for previous notes before creating.
+
+## Installation
+
+rsskey depends on [feedparser], [httpx], [loca], [markdownify] and [trio].
+If you `pip install rsskey`, pip will install all the dependencies for you
+to run `python -m rsskey`.
+
+Alternatively, you can get the requirements from your distribution,
+fetch the source tree and execute `src/rsskey.py`.
+
+## Usage
+
+In rsskey's [user configuration directory][loca],
+declare the mirroring jobs in `jobs.conf`, for example:
+
+```ini
+[rms@birb.space]
+; URL to RSS/Atom feed source
+source = https://stallman.org/rss/rss.xml
+; URL to destination Misskey instance's API
+dest = https://birb.space/api
+; Character limit of the Misskey instance
+limit = 420
+; Misskey user ID for searching previous notes
+user = 8rt4sahf1j
+; Access token with permission to compose notes
+token = 7h4753cur3r4nd0m57r1n61764v3y0u
+```
+
+In order to run rsskey chronically, set up a cron job or something IDK.
+
+## Contributing
+
+Patches should be sent to [~cnx/misc@lists.sr.ht]
+using [git send-email] with the following configurations:
+
+    git config sendemail.to '~cnx/misc@lists.sr.ht'
+    git config format.subjectPrefix 'PATCH rsskey'
+
+## Copying
+
+![AGPLv3](https://www.gnu.org/graphics/agplv3-155x51.png)
+
+rsskey is free software: you can redistribute it and/or modify it
+under the terms of the GNU [Affero General Public License][agplv3] as
+published by the Free Software Foundation, either version 3 of the License,
+or (at your option) any later version.
+
+[RSS]: https://www.rssboard.org/rss-specification
+[Atom]: https://tools.ietf.org/html/rfc5023
+[Misskey]: https://join.misskey.page
+[feedparser]: https://feedparser.readthedocs.io
+[httpx]: https://www.python-httpx.org
+[loca]: https://pypi.org/project/loca
+[markdownify]: https://pypi.org/project/markdownify
+[trio]: https://trio.readthedocs.io
+[~cnx/misc@lists.sr.ht]: https://lists.sr.ht/~cnx/misc
+[git send-email]: https://git-send-email.io
+[agplv3]: https://www.gnu.org/licenses/agpl-3.0.html
diff --git a/pyproject.toml b/pyproject.toml
index 37b2c79..963225a 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,20 +4,21 @@ build-backend = "flit_core.buildapi"
 
 [project]
 name = "rsskey"
-version = "0.0.1"
+version = "0.1.0"
 description = "RSS feed mirror on Misskey"
 readme = "README.md"
-requires-python = ">=3.6"
+requires-python = ">=3.7"
 license = { file = "COPYING" }
 authors = [ { name = "Nguyễn Gia Phong", email = "mcsinyx@disroot.org" } ]
 maintainers = [ { name = "Nguyễn Gia Phong", email = "mcsinyx@disroot.org" } ]
 keywords = [ "rss", "misskey" ]
 classifiers = [
     "Development Status :: 5 - Production/Stable",
-    "Intended Audience :: Developers",
+    "Framework :: Trio",
+    "Intended Audience :: System Administrators",
     "License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)",
     "Operating System :: OS Independent",
-    "Programming Language :: Python" ]
-dependencies = [
-    "feedparser", "httpx", "loca", "markdownify", "python-dateutil", "trio" ]
-urls = { project = "https://sr.ht/~cnx/rsskey" }
+    "Programming Language :: Python",
+    "Topic :: Utilities" ]
+dependencies = [ "feedparser", "httpx", "loca", "markdownify", "trio" ]
+urls = { SourceHut = "https://sr.ht/~cnx/rsskey" }
diff --git a/src/rsskey.py b/src/rsskey.py
index f88bd7e..6e938e0 100755
--- a/src/rsskey.py
+++ b/src/rsskey.py
@@ -20,8 +20,7 @@ from contextlib import AsyncExitStack
 from functools import partial
 from re import split, sub
 
-from dateutil.parser import parse as parse_time
-from feedparser import parse as parse_feed
+from feedparser import parse
 from httpx import AsyncClient
 from loca import Loca
 from markdownify import markdownify as md
@@ -68,7 +67,7 @@ async def post(job, client, link, title, summary):
 async def mirror(nursery, job, client):
     """Perform the given mirror job."""
     feed = await client.get(job['source'])
-    for entry in parse_feed(feed.text)['entries']:
+    for entry in parse(feed.text)['entries']:
         nursery.start_soon(post, job, client, entry['link'],
                            entry['title'], entry['summary'])