本文整理汇总了Python中scraper.Scraper.registered_manga方法的典型用法代码示例。如果您正苦于以下问题:Python Scraper.registered_manga方法的具体用法?Python Scraper.registered_manga怎么用?Python Scraper.registered_manga使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scraper.Scraper
的用法示例。
在下文中一共展示了Scraper.registered_manga方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: DentonBot
# 需要导入模块: from scraper import Scraper [as 别名]
# 或者: from scraper.Scraper import registered_manga [as 别名]
class DentonBot(pyrc.Bot):
def __init__(self, *args, **kwargs):
super(DentonBot, self).__init__(*args, **kwargs)
self.scraper = Scraper()
# todo: add mangastream to these as well
self.scraper.add_manga("One Piece", ["mangahere"])
self.scraper.add_manga("Bleach", ["mangahere"])
self.scraper.add_manga("Naruto", ["mangahere"])
self.scraper.add_manga("Fairy Tail", ["mangahere"])
self.scraper.add_manga("Toriko", ["mangahere"])
self.scraper.add_manga("Cage of Eden", ["mangahere"])
self.scraper.add_manga("Gamaran", ["mangahere"])
self.scraper.add_manga("Magi", ["mangahere"])
self.scraper.add_manga("Shaman King Flowers", ["mangahere"])
self.scraper.add_manga("Soul Eater", ["mangahere"])
self.scraper.add_manga("The Breaker: New Waves", ["mangahere"])
self.scraper.add_manga("The World God Only Knows", ["mangahere"])
self.scraper.add_manga("Until Death Do Us Part", ["mangahere"])
self.scraper.add_manga("Witch Hunter", ["mangahere"])
self.scraper.add_manga("Yotsubato!", ["mangahere"])
@hooks.command(r"help|advice")
def help(self, channel):
self.message(channel, random.choice(advice))
@hooks.command(r"list|registered")
def registered(self, channel):
manga = self.scraper.registered_manga()
manga_str = ", ".join(manga)
self.message(channel, "Registered manga include %s" % manga_str)
@hooks.command("fetch manga")
def fetch_manga(self, channel):
results = self.scraper.get_all_manga()
for (name, chapter, link) in results:
self.message(channel, "%s %i: %s" % (name, chapter, link))
@hooks.command(r"last (?P<manga_name>.*)")
def last(self, channel, manga_name):
manga_name = manga_name.strip()
manga_name = aliases.get(manga_name, manga_name)
manga_tuple = self.scraper.get_manga(manga_name)
if manga_tuple and not manga_tuple[2]:
self.message(channel, "Sorry, don't have the latest %s" % manga_tuple[0])
elif manga_tuple:
self.message(channel, "%s %i: %s" % manga_tuple)
else:
self.message(channel, "I'm not big into books")
@hooks.interval(2 * 60 * 1000)
def scrape(self):
results = self.scraper.scrape()
for (name, chapter, link) in results:
msg = "New %s (%i): %s" % (name, chapter, link)
for channel in CHANNELS:
self.message(channel, msg)
def close(self):
super(DentonBot, self).close()