LastFM: drop depends on bs4

This commit is contained in:
James Lu 2014-12-20 23:03:08 -08:00
parent 6d03a08fee
commit 610eab51f8
3 changed files with 3 additions and 8 deletions

View File

@ -4,13 +4,11 @@ supybot-lastfm (GLolol's fork)
[![Build Status](https://travis-ci.org/GLolol/supybot-lastfm.svg?branch=devel)](https://travis-ci.org/GLolol/supybot-lastfm) [![Build Status](https://travis-ci.org/GLolol/supybot-lastfm.svg?branch=devel)](https://travis-ci.org/GLolol/supybot-lastfm)
A plugin for Supybot that displays various information about LastFM IDs on IRC. A plugin for Supybot that displays various information about LastFM IDs on IRC.
**This version of the plugin depends on Beautiful Soup 4 and lxml for parsing! (This may change in the future).**
### Changes made in this fork: ### Changes made in this fork:
- Native Python 3 support. - Native Python 3 support.
- Code cleanup (use Supybot's built in URL fetcher instead of urllib/urllib2). - Code cleanup (use Supybot's built in URL fetcher instead of urllib/urllib2).
- Bug fixes. - Various bugfixes.
A full list of changes can be found [here](https://github.com/GLolol/supybot-lastfm/compare/krf:master...devel). A full list of changes can be found [here](https://github.com/GLolol/supybot-lastfm/compare/krf:master...devel).

View File

@ -39,7 +39,6 @@ import supybot.callbacks as callbacks
import supybot.world as world import supybot.world as world
import supybot.log as log import supybot.log as log
from bs4 import BeautifulSoup
from xml.dom import minidom from xml.dom import minidom
from time import time from time import time
try: try:
@ -134,8 +133,8 @@ class LastFM(callbacks.Plugin):
irc.error("Unknown ID (%s) or unknown method (%s)" irc.error("Unknown ID (%s) or unknown method (%s)"
% (msg.nick, method), Raise=True) % (msg.nick, method), Raise=True)
soup = BeautifulSoup(f, "xml") xml = minidom.parse(f).getElementsByTagName("lfm")[0]
content = soup.find("lfm").contents[1].find_all("name") content = xml.childNodes[1].getElementsByTagName("name")
results = [res.string.strip() for res in content[0:maxResults*2]] results = [res.string.strip() for res in content[0:maxResults*2]]
if method in ('topalbums', 'toptracks'): if method in ('topalbums', 'toptracks'):
# Annoying, hackish way of grouping artist+album/track items # Annoying, hackish way of grouping artist+album/track items

View File

@ -1,3 +1 @@
git+https://github.com/ProgVal/Limnoria.git git+https://github.com/ProgVal/Limnoria.git
beautifulsoup4
lxml