Add a script for easy linking to articles on my page

This commit is contained in:
ItsDrike 2021-10-03 01:01:59 +02:00
parent 37abf13fd3
commit fd245c7758
No known key found for this signature in database
GPG key ID: FB8CA11A2CF3A843

View file

@ -0,0 +1,23 @@
#!/usr/bin/env python
import feedparser
import subprocess
URL = "https://itsdrike.com/posts/index.xml"
def main():
feed = feedparser.parse(URL)
titles = {entry['title']: entry['link'] for entry in feed['entries']}
selected_page = subprocess.check_output(
["dmenu", "-i", "-p", "Post"],
input="\n".join(titles.keys()), universal_newlines=True
)
link = titles[selected_page.strip()]
subprocess.check_output(["xsel", "-bi"], input=link, universal_newlines=True)
if __name__ == '__main__':
main()