diff --git a/.vscode/launch.json b/.vscode/launch.json index d187b87..7b08b05 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,13 +1,13 @@ { - "version": "0.2.0", - "configurations": [ - { - "type" : "debugpy", - "request": "launch", - "name": "Launch project", - "cwd": "${workspaceFolder}", - "module": "python-project-template", - //"args": ["run", "python", "-m", "python-project-template"], - } -] -} \ No newline at end of file + "version": "0.2.0", + "configurations": [ + { + "type": "debugpy", + "request": "launch", + "name": "Launch project", + "cwd": "${workspaceFolder}", + "module": "rss-mastodon-poster" + //"args": ["run", "python", "-m", "python-project-template"], + } + ] +} diff --git a/pyproject.toml b/pyproject.toml index 17fd75e..9034d58 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,6 +9,7 @@ package-mode = false [tool.poetry.dependencies] python = "^3.11" +feedparser = "^6.0.11" [build-system] diff --git a/python-project-template/__main__.py b/python-project-template/__main__.py deleted file mode 100644 index f50f024..0000000 --- a/python-project-template/__main__.py +++ /dev/null @@ -1,7 +0,0 @@ -# !/usr/bin/env python3 - -def main(): - print("Hello World!") - -if __name__ == '__main__': - main() diff --git a/python-project-template/__init__.py b/rss-mastodon-poster/__init__.py similarity index 100% rename from python-project-template/__init__.py rename to rss-mastodon-poster/__init__.py diff --git a/rss-mastodon-poster/__main__.py b/rss-mastodon-poster/__main__.py new file mode 100644 index 0000000..86bd30d --- /dev/null +++ b/rss-mastodon-poster/__main__.py @@ -0,0 +1,22 @@ +# !/usr/bin/env python3 + +import feedparser +import pprint + +# rss_url = "https://www.city.taito.lg.jp/rss_news.xml" +rss_url = 'https://notes.kinoshita-lab.org/index.xml' + + +def main(): + parsed = feedparser.parse(rss_url) + for entry in parsed.entries: + print("id: {}".format(entry.id)) + print("title: {}".format(entry.title)) + print("link: {}".format(entry.link)) + print("published: {}".format(entry.published)) + # print("description: {}".format(entry.description)) + # pprint.pprint(entry) + + +if __name__ == '__main__': + main()