/usr/share/pyshared/rawdoglib/fakefinder.py is in rawdog 2.13.dfsg.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | # Anemic replacement for feedfinder (which Debian can't distribute) so
# that ``rawdog -a'' at least does *something*. Only checks for the
# existence of <link rel='alternate' ... /> in an HTML (or XML) document;
# falls back to the given URI otherwise, e.g. if the URI is already a
# feed (and only contains text/html alternates, in the case of Atom), or
# is something we don't recognize. Unlike with the real feedfinder, you
# *can* add garbage to your config with this if you give it a garbage
# URI. Also, the first link that appears ends up at the head of the
# list, so hope it's not the RSS 0.9 one. What do you want for 16 lines?
#
# This stupid thing is copyright (c) 2008 Decklin Foster
# <decklin@red-bean.com>, who really ought to know better, and is
# released under the following license:
#
# Permission to use, copy, modify, and/or distribute this software for
# any purpose with or without fee is hereby granted, provided that
# the above copyright notice and this permission notice appear in all
# copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
# WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
# AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
# OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
import urllib
from HTMLParser import HTMLParser
def feeds(uri):
parser = FeedFinder()
parser.feed(urllib.urlopen(uri).read())
return parser.feeds + [uri]
class FeedFinder(HTMLParser):
def __init__(self):
HTMLParser.__init__(self)
self.feeds = []
def handle_startendtag(self, tag, attrs):
attrs = dict(attrs)
if tag == 'link' and attrs.get('rel') == 'alternate' and \
not attrs.get('type') == 'text/html':
self.feeds.append(attrs['href'])
|