simplify and factorize code, remove dead code, follow conventions, use new-style classes

This commit is contained in:
Christophe Benz 2010-12-09 15:27:06 +01:00 committed by Romain Bignon
commit f1b3264a67
28 changed files with 202 additions and 251 deletions

View file

@ -15,26 +15,27 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
from weboob.tools.browser import BaseBrowser
from .pages.board import BoardPage
class FourChan(BaseBrowser):
DOMAIN = 'boards.4chan.org'
PAGES = {'http://boards.4chan.org/\w+/': BoardPage,
'http://boards.4chan.org/\w+/res/\d+': BoardPage,
}
PAGES = {
'http://boards.4chan.org/\w+/': BoardPage,
'http://boards.4chan.org/\w+/res/\d+': BoardPage,
}
def is_logged(self):
return True
def get_threads(self, board):
self.location('http://boards.4chan.org/%s/' % board)
return self.page.articles
def get_thread(self, board, id):
self.location('http://boards.4chan.org/%s/res/%d' % (board, long(id)))
assert len(self.page.articles) == 1
return self.page.articles[0]