From e9dbaad0d71ab580d4303ba622d9690ce8e3471f Mon Sep 17 00:00:00 2001 From: Felix Van der Jeugt Date: Mon, 26 Jan 2015 14:14:39 +0100 Subject: [PATCH] newsbeuter - scrape mangahere latest to rss --- local/bin/mangahere_rss.py | 44 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100755 local/bin/mangahere_rss.py diff --git a/local/bin/mangahere_rss.py b/local/bin/mangahere_rss.py new file mode 100755 index 0000000..edb9c80 --- /dev/null +++ b/local/bin/mangahere_rss.py @@ -0,0 +1,44 @@ +#!/usr/bin/python + +from pyquery import PyQuery as pq +from pprint import pprint +import sys + +ITEM = """ + + {title} + {description} + {link} +""" + +class Release(object): + + def __init__(self, title, link): + self.title = title + self.link = link + + def __str__(self): + return ITEM.format( + title=self.title, + description="New release: {}".format(self.title), + link=self.link) + + def __contains__(self, string): + return string in self.title or string in self.link + +latest = pq(url="http://www.mangahere.co/latest/") + +print("""\ + + +""") + +for item in map(pq, latest("dd > a")): + release = Release(item.attr("title"), item.attr("href")) + if any(word in release for word in sys.argv): + print(str(release)) + +print(""" + + +""")