|
@@ 2342-2361 (lines=20) @@
|
| 2339 |
|
|
| 2340 |
|
class AnythingComic(GenericListableComic): |
| 2341 |
|
"""Class to retrieve Anything Comics.""" |
| 2342 |
|
# Also on http://tapastic.com/series/anything |
| 2343 |
|
name = 'anythingcomic' |
| 2344 |
|
long_name = 'Anything Comic' |
| 2345 |
|
url = 'http://www.anythingcomic.com' |
| 2346 |
|
|
| 2347 |
|
@classmethod |
| 2348 |
|
def get_archive_elements(cls): |
| 2349 |
|
archive_url = urljoin_wrapper(cls.url, 'archive/') |
| 2350 |
|
# The first 2 <tr>'s do not correspond to comics |
| 2351 |
|
return get_soup_at_url(archive_url).find('table', id='chapter_table').find_all('tr')[2:] |
| 2352 |
|
|
| 2353 |
|
@classmethod |
| 2354 |
|
def get_url_from_archive_element(cls, tr): |
| 2355 |
|
"""Get url corresponding to an archive element.""" |
| 2356 |
|
_, td_comic, td_date, _ = tr.find_all('td') |
| 2357 |
|
link = td_comic.find('a') |
| 2358 |
|
return urljoin_wrapper(cls.url, link['href']) |
| 2359 |
|
|
| 2360 |
|
@classmethod |
| 2361 |
|
def get_comic_info(cls, soup, tr): |
| 2362 |
|
"""Get information about a particular comics.""" |
| 2363 |
|
td_num, td_comic, td_date, _ = tr.find_all('td') |
| 2364 |
|
num = int(td_num.string) |
|
@@ 1959-1977 (lines=19) @@
|
| 1956 |
|
'img': [urljoin_wrapper(comic_url, img['src'].strip())], |
| 1957 |
|
'num': int(comic_url.split('/')[-1]), |
| 1958 |
|
} |
| 1959 |
|
|
| 1960 |
|
|
| 1961 |
|
class InvisibleBread(GenericListableComic): |
| 1962 |
|
"""Class to retrieve Invisible Bread comics.""" |
| 1963 |
|
# Also on http://www.gocomics.com/invisible-bread |
| 1964 |
|
name = 'invisiblebread' |
| 1965 |
|
long_name = 'Invisible Bread' |
| 1966 |
|
url = 'http://invisiblebread.com' |
| 1967 |
|
|
| 1968 |
|
@classmethod |
| 1969 |
|
def get_archive_elements(cls): |
| 1970 |
|
archive_url = urljoin_wrapper(cls.url, 'archives/') |
| 1971 |
|
return reversed(get_soup_at_url(archive_url).find_all('td', class_='archive-title')) |
| 1972 |
|
|
| 1973 |
|
@classmethod |
| 1974 |
|
def get_url_from_archive_element(cls, td): |
| 1975 |
|
return td.find('a')['href'] |
| 1976 |
|
|
| 1977 |
|
@classmethod |
| 1978 |
|
def get_comic_info(cls, soup, td): |
| 1979 |
|
"""Get information about a particular comics.""" |
| 1980 |
|
url = cls.get_url_from_archive_element(td) |