From 3b0142cedcde39e4c2097ecd916a870a3ced5ec6 Mon Sep 17 00:00:00 2001 From: Vito Graffagnino Date: Tue, 8 Sep 2020 18:10:49 +0100 Subject: Added the relevent parts of the .config directory. Alss add ssh config --- .config/qutebrowser/misc/userscripts/openfeeds | 40 ++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 .config/qutebrowser/misc/userscripts/openfeeds (limited to '.config/qutebrowser/misc/userscripts/openfeeds') diff --git a/.config/qutebrowser/misc/userscripts/openfeeds b/.config/qutebrowser/misc/userscripts/openfeeds new file mode 100755 index 0000000..4a1a942 --- /dev/null +++ b/.config/qutebrowser/misc/userscripts/openfeeds @@ -0,0 +1,40 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Copyright 2015 jnphilipp +# Copyright 2016-2017 Florian Bruhin (The Compiler) +# +# This file is part of qutebrowser. +# +# qutebrowser is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# qutebrowser is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with qutebrowser. If not, see . + +# Opens all links to feeds defined in the head of a site +# +# Ideal for use with tabs_are_windows. Set a hotkey to launch this script, then: +# :bind gF spawn --userscript openfeeds +# +# Use the hotkey to open the feeds in new tab/window, press 'gF' to open +# + +import os +import re + +from bs4 import BeautifulSoup +from urllib.parse import urljoin + +with open(os.environ['QUTE_HTML'], 'r') as f: + soup = BeautifulSoup(f) +with open(os.environ['QUTE_FIFO'], 'w') as f: + for link in soup.find_all('link', rel='alternate', type=re.compile(r'application/((rss|rdf|atom)\+)?xml|text/xml')): + f.write('open -t %s\n' % urljoin(os.environ['QUTE_URL'], link.get('href'))) -- cgit v1.2.3