diff --git a/README.asciidoc b/README.asciidoc index c8abad993..b0a77488c 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -157,6 +157,7 @@ Contributors, sorted by the number of commits in descending order: * Error 800 * Brian Jackson * sbinix +* jnphilipp * Tobias Patzl * Johannes Altmanninger * Samir Benmendil diff --git a/misc/userscripts/openfeeds b/misc/userscripts/openfeeds new file mode 100755 index 000000000..9e619ec83 --- /dev/null +++ b/misc/userscripts/openfeeds @@ -0,0 +1,38 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +# Copyright 2015 jnphilipp +# +# 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 + +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' % link.get('href'))