From f3b2b032de2fcdcb49ed1791b450617591316f7a Mon Sep 17 00:00:00 2001 From: cellarspoon Date: Wed, 5 Jan 2022 13:39:01 +0100 Subject: [PATCH] feat: support feed generation --- .gitignore | 5 ++- lumbunglib/templates/feed.md | 2 +- poetry.lock | 73 +++++++++++++++++++++++++++++++++++- pyproject.toml | 3 ++ setup.py | 8 +++- 5 files changed, 87 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index b1e61e7..16f6917 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ -test +*.txt +*.txt.* __pycache__ +etags +test diff --git a/lumbunglib/templates/feed.md b/lumbunglib/templates/feed.md index 231e15c..74ddc3a 100644 --- a/lumbunglib/templates/feed.md +++ b/lumbunglib/templates/feed.md @@ -7,7 +7,7 @@ author: "{{ frontmatter.author }}" original_link: "{{ frontmatter.original_link }}" feed_name: "{{ frontmatter.feed_name}}" categories: ["network", "{{ frontmatter.feed_name}}"] -tags: { { frontmatter.tags } } +tags: {{ frontmatter.tags }} --- {{ content }} diff --git a/poetry.lock b/poetry.lock index a6bbf37..8635a47 100644 --- a/poetry.lock +++ b/poetry.lock @@ -9,6 +9,32 @@ python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" [package.dependencies] python-dateutil = "*" +[[package]] +name = "beautifulsoup4" +version = "4.10.0" +description = "Screen-scraping library" +category = "main" +optional = false +python-versions = ">3.0.0" + +[package.dependencies] +soupsieve = ">1.2" + +[package.extras] +html5lib = ["html5lib"] +lxml = ["lxml"] + +[[package]] +name = "bs4" +version = "0.0.1" +description = "Dummy package for Beautiful Soup" +category = "main" +optional = false +python-versions = "*" + +[package.dependencies] +beautifulsoup4 = "*" + [[package]] name = "certifi" version = "2021.10.8" @@ -28,6 +54,17 @@ python-versions = ">=3.5.0" [package.extras] unicode_backport = ["unicodedata2"] +[[package]] +name = "feedparser" +version = "6.0.8" +description = "Universal feed parser, handles RSS 0.9x, RSS 1.0, RSS 2.0, CDF, Atom 0.3, and Atom 1.0 feeds" +category = "main" +optional = false +python-versions = ">=3.6" + +[package.dependencies] +sgmllib3k = "*" + [[package]] name = "ics" version = "0.7" @@ -166,6 +203,14 @@ urllib3 = ">=1.21.1,<1.27" socks = ["PySocks (>=1.5.6,!=1.5.7)", "win-inet-pton"] use_chardet_on_py3 = ["chardet (>=3.0.2,<5)"] +[[package]] +name = "sgmllib3k" +version = "1.0.0" +description = "Py3k port of sgmllib." +category = "main" +optional = false +python-versions = "*" + [[package]] name = "six" version = "1.16.0" @@ -174,6 +219,14 @@ category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" +[[package]] +name = "soupsieve" +version = "2.3.1" +description = "A modern CSS selector implementation for Beautiful Soup." +category = "main" +optional = false +python-versions = ">=3.6" + [[package]] name = "tatsu" version = "5.7.0" @@ -209,13 +262,20 @@ socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"] [metadata] lock-version = "1.1" python-versions = "^3.9" -content-hash = "e355abc98d6deaf8a6d6a3567394dec76c33e05212e4913b0d03173f137ca43b" +content-hash = "b3ef4c21f227ad6f9fdb9fd049dd7246eb805fcec1c67492d54398175afa032d" [metadata.files] arrow = [ {file = "arrow-0.14.7-py2.py3-none-any.whl", hash = "sha256:4bfacea734ead51495dc47df00421ecfd4ca1f2c0fbe58b9a26eaeddedc31caf"}, {file = "arrow-0.14.7.tar.gz", hash = "sha256:67f8be7c0cf420424bc62d8d7dc40b44e4bb2f7b515f9cc2954fb36e35797656"}, ] +beautifulsoup4 = [ + {file = "beautifulsoup4-4.10.0-py3-none-any.whl", hash = "sha256:9a315ce70049920ea4572a4055bc4bd700c940521d36fc858205ad4fcde149bf"}, + {file = "beautifulsoup4-4.10.0.tar.gz", hash = "sha256:c23ad23c521d818955a4151a67d81580319d4bf548d3d49f4223ae041ff98891"}, +] +bs4 = [ + {file = "bs4-0.0.1.tar.gz", hash = "sha256:36ecea1fd7cc5c0c6e4a1ff075df26d50da647b75376626cc186e2212886dd3a"}, +] certifi = [ {file = "certifi-2021.10.8-py2.py3-none-any.whl", hash = "sha256:d62a0163eb4c2344ac042ab2bdf75399a71a2d8c7d47eac2e2ee91b9d6339569"}, {file = "certifi-2021.10.8.tar.gz", hash = "sha256:78884e7c1d4b00ce3cea67b44566851c4343c120abd683433ce934a68ea58872"}, @@ -224,6 +284,10 @@ charset-normalizer = [ {file = "charset-normalizer-2.0.9.tar.gz", hash = "sha256:b0b883e8e874edfdece9c28f314e3dd5badf067342e42fb162203335ae61aa2c"}, {file = "charset_normalizer-2.0.9-py3-none-any.whl", hash = "sha256:1eecaa09422db5be9e29d7fc65664e6c33bd06f9ced7838578ba40d58bdf3721"}, ] +feedparser = [ + {file = "feedparser-6.0.8-py3-none-any.whl", hash = "sha256:1b7f57841d9cf85074deb316ed2c795091a238adb79846bc46dccdaf80f9c59a"}, + {file = "feedparser-6.0.8.tar.gz", hash = "sha256:5ce0410a05ab248c8c7cfca3a0ea2203968ee9ff4486067379af4827a59f9661"}, +] ics = [ {file = "ics-0.7-py2.py3-none-any.whl", hash = "sha256:bf5fbdef6e1e073afdadf1b996f0271186dd114a148e38e795919a1ae644d6ac"}, {file = "ics-0.7-py3.7.egg", hash = "sha256:3b606205b9582ad27dff77f9b227a30d02fdac532731927fe39df1f1ddf8673f"}, @@ -297,10 +361,17 @@ requests = [ {file = "requests-2.26.0-py2.py3-none-any.whl", hash = "sha256:6c1246513ecd5ecd4528a0906f910e8f0f9c6b8ec72030dc9fd154dc1a6efd24"}, {file = "requests-2.26.0.tar.gz", hash = "sha256:b8aa58f8cf793ffd8782d3d8cb19e66ef36f7aba4353eec859e74678b01b07a7"}, ] +sgmllib3k = [ + {file = "sgmllib3k-1.0.0.tar.gz", hash = "sha256:7868fb1c8bfa764c1ac563d3cf369c381d1325d36124933a726f29fcdaa812e9"}, +] six = [ {file = "six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254"}, {file = "six-1.16.0.tar.gz", hash = "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926"}, ] +soupsieve = [ + {file = "soupsieve-2.3.1-py3-none-any.whl", hash = "sha256:1a3cca2617c6b38c0343ed661b1fa5de5637f257d4fe22bd9f1338010a1efefb"}, + {file = "soupsieve-2.3.1.tar.gz", hash = "sha256:b8d49b1cd4f037c7082a9683dfa1801aa2597fb11c3a1155b7a5b94829b4f1f9"}, +] tatsu = [ {file = "TatSu-5.7.0-py2.py3-none-any.whl", hash = "sha256:9eebadfc2889d8e82e197df22913df56ff204bf4cfc62db49a5c7edd084e10b4"}, {file = "TatSu-5.7.0.zip", hash = "sha256:428136cd4aa9600fcd01428bd5667fc752062f54bd0148dc1e64fee7b8d05fa4"}, diff --git a/pyproject.toml b/pyproject.toml index 172ae27..f3d5b0d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,6 +13,8 @@ natural = "^0.2.0" python-slugify = "^5.0.2" requests = "^2.26.0" peertube = {git = "https://framagit.org/framasoft/peertube/clients/python.git"} +feedparser = "^6.0.8" +bs4 = "^0.0.1" [tool.poetry.dev-dependencies] poetry2setup = "^1.0.0" @@ -24,3 +26,4 @@ build-backend = "poetry.core.masonry.api" [tool.poetry.scripts] lumbunglib-cal = "lumbunglib.cloudcal:main" lumbunglib-vid = "lumbunglib.video:main" +lumbunglib-feed = "lumbunglib.feed:main" diff --git a/setup.py b/setup.py index da49d11..e94d439 100644 --- a/setup.py +++ b/setup.py @@ -7,6 +7,8 @@ package_data = {"": ["*"], "lumbunglib": ["templates/*"]} install_requires = [ "Jinja2>=3.0.3,<4.0.0", + "bs4>=0.0.1,<0.0.2", + "feedparser>=6.0.8,<7.0.0", "ics>=0.7,<0.8", "natural>=0.2.0,<0.3.0", "peertube @ " @@ -16,7 +18,11 @@ install_requires = [ ] entry_points = { - "console_scripts": ["cal = lumbunglib.cloudcal:main", "vid = lumbunglib.video:main"] + "console_scripts": [ + "lumbunglib-cal = lumbunglib.cloudcal:main", + "lumbunglib-feed = lumbunglib.feed:main", + "lumbunglib-vid = lumbunglib.video:main", + ] } setup_kwargs = {