Update GoComics.

This commit is contained in:
Tobias Gruetzmacher 2016-04-15 00:26:14 +02:00
parent 031a523846
commit 52515b5fc5
3 changed files with 12 additions and 11 deletions

View file

@ -48,6 +48,10 @@ class GCAbnormalTruth(_GoComics):
path = 'abnormal-truth'
class GCABomb(_GoComics):
path = 'a-bomb'
class GCABootsAndPupComic(_GoComics):
path = 'a-boots-and-pup-comic'
@ -657,10 +661,6 @@ class GCABitSketch(_GoComics):
path = 'a-bit-sketch'
class GCABomb(_GoComics):
path = 'a-bomb'
class GCACMEINKD(_GoComics):
path = 'acme-inkd'
@ -1641,10 +1641,6 @@ class GCHaphazardHumor(_GoComics):
path = 'haphazard-humor'
class GCHappyBoyBobsAnimatedGifs(_GoComics):
path = 'happy-boy-bobs-animated-gifs'
class GCHarambeeHills(_GoComics):
path = 'harambeehills'
@ -2901,6 +2897,10 @@ class GCSuburbanFairyTales(_GoComics):
path = 'suburban-fairy-tales'
class GCSUITSANDGUARDERS(_GoComics):
path = 'suits-and-guarders'
class GCSunnyStreet(_GoComics):
path = 'sunny-street'

View file

@ -30,7 +30,7 @@ class GoComicsUpdater(ComicListUpdater):
def handle_url(self, url):
"""Parse one search result page."""
data = self.get_url(url)
data = self.get_url(url, expand=False)
for comiclink in data.cssselect('a.alpha_list'):
link = comiclink.attrib['href']

View file

@ -32,12 +32,13 @@ class ComicListUpdater(object):
self.json = name.replace(".py", ".json")
self.session = requests.Session()
def get_url(self, url):
def get_url(self, url, expand=True):
"""Get an HTML page and parse it with LXML."""
print("Parsing", url, file=sys.stderr)
try:
data = html.document_fromstring(get_page(url, self.session).text)
data.make_links_absolute(url)
if expand:
data.make_links_absolute(url)
return data
except IOError as msg:
print("ERROR:", msg, file=sys.stderr)