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

View file

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

View file

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