mirror of
https://github.com/ItsDrike/dotfiles.git
synced 2024-12-25 12:44:35 +00:00
Add a script for easy linking to articles on my page
This commit is contained in:
parent
37abf13fd3
commit
fd245c7758
23
home/.local/bin/scripts/dmenu/website-link
Executable file
23
home/.local/bin/scripts/dmenu/website-link
Executable 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()
|
Loading…
Reference in a new issue