@@ 2046-2069 (lines=24) @@ | ||
2043 | } |
|
2044 | ||
2045 | ||
2046 | class PoorlyDrawnLines(GenericListableComic): |
|
2047 | """Class to retrieve Poorly Drawn Lines comics.""" |
|
2048 | # Also on http://pdlcomics.tumblr.com |
|
2049 | name = 'poorlydrawn' |
|
2050 | long_name = 'Poorly Drawn Lines' |
|
2051 | url = 'https://www.poorlydrawnlines.com' |
|
2052 | _categories = ('POORLYDRAWN', ) |
|
2053 | get_url_from_archive_element = get_href |
|
2054 | ||
2055 | @classmethod |
|
2056 | def get_comic_info(cls, soup, link): |
|
2057 | """Get information about a particular comics.""" |
|
2058 | imgs = soup.find('div', class_='post').find_all('img') |
|
2059 | assert len(imgs) <= 1, imgs |
|
2060 | return { |
|
2061 | 'img': [i['src'] for i in imgs], |
|
2062 | 'title': imgs[0].get('title', "") if imgs else "", |
|
2063 | } |
|
2064 | ||
2065 | @classmethod |
|
2066 | def get_archive_elements(cls): |
|
2067 | archive_url = urljoin_wrapper(cls.url, 'archive') |
|
2068 | url_re = re.compile('^%s/comic/.' % cls.url) |
|
2069 | return reversed(get_soup_at_url(archive_url).find_all('a', href=url_re)) |
|
2070 | ||
2071 | ||
2072 | class LoadingComics(GenericNavigableComic): |
|
@@ 1067-1088 (lines=22) @@ | ||
1064 | } |
|
1065 | ||
1066 | ||
1067 | class PerryBibleFellowship(GenericListableComic): # Is now navigable too |
|
1068 | """Class to retrieve Perry Bible Fellowship comics.""" |
|
1069 | name = 'pbf' |
|
1070 | long_name = 'Perry Bible Fellowship' |
|
1071 | url = 'http://pbfcomics.com' |
|
1072 | get_url_from_archive_element = join_cls_url_to_href |
|
1073 | ||
1074 | @classmethod |
|
1075 | def get_archive_elements(cls): |
|
1076 | soup = get_soup_at_url(cls.url) |
|
1077 | thumbnails = soup.find('div', id='all_thumbnails') |
|
1078 | return reversed(thumbnails.find_all('a')) |
|
1079 | ||
1080 | @classmethod |
|
1081 | def get_comic_info(cls, soup, link): |
|
1082 | """Get information about a particular comics.""" |
|
1083 | name = soup.find('meta', property='og:title')['content'] |
|
1084 | imgs = soup.find_all('meta', property='og:image') |
|
1085 | assert len(imgs) == 1, imgs |
|
1086 | return { |
|
1087 | 'name': name, |
|
1088 | 'img': [i['content'] for i in imgs], |
|
1089 | } |
|
1090 | ||
1091 |