@@ 2107-2130 (lines=24) @@ | ||
2104 | } |
|
2105 | ||
2106 | ||
2107 | class PoorlyDrawnLines(GenericListableComic): |
|
2108 | """Class to retrieve Poorly Drawn Lines comics.""" |
|
2109 | # Also on http://pdlcomics.tumblr.com |
|
2110 | name = 'poorlydrawn' |
|
2111 | long_name = 'Poorly Drawn Lines' |
|
2112 | url = 'https://www.poorlydrawnlines.com' |
|
2113 | _categories = ('POORLYDRAWN', ) |
|
2114 | get_url_from_archive_element = get_href |
|
2115 | ||
2116 | @classmethod |
|
2117 | def get_comic_info(cls, soup, link): |
|
2118 | """Get information about a particular comics.""" |
|
2119 | imgs = soup.find('div', class_='post').find_all('img') |
|
2120 | assert len(imgs) <= 1, imgs |
|
2121 | return { |
|
2122 | 'img': [i['src'] for i in imgs], |
|
2123 | 'title': imgs[0].get('title', "") if imgs else "", |
|
2124 | } |
|
2125 | ||
2126 | @classmethod |
|
2127 | def get_archive_elements(cls): |
|
2128 | archive_url = urljoin_wrapper(cls.url, 'archive') |
|
2129 | url_re = re.compile('^%s/comic/.' % cls.url) |
|
2130 | return reversed(get_soup_at_url(archive_url).find_all('a', href=url_re)) |
|
2131 | ||
2132 | ||
2133 | class LoadingComics(GenericNavigableComic): |
|
@@ 1094-1115 (lines=22) @@ | ||
1091 | } |
|
1092 | ||
1093 | ||
1094 | class PerryBibleFellowship(GenericListableComic): # Is now navigable too |
|
1095 | """Class to retrieve Perry Bible Fellowship comics.""" |
|
1096 | name = 'pbf' |
|
1097 | long_name = 'Perry Bible Fellowship' |
|
1098 | url = 'http://pbfcomics.com' |
|
1099 | get_url_from_archive_element = join_cls_url_to_href |
|
1100 | ||
1101 | @classmethod |
|
1102 | def get_archive_elements(cls): |
|
1103 | soup = get_soup_at_url(cls.url) |
|
1104 | thumbnails = soup.find('div', id='all_thumbnails') |
|
1105 | return reversed(thumbnails.find_all('a')) |
|
1106 | ||
1107 | @classmethod |
|
1108 | def get_comic_info(cls, soup, link): |
|
1109 | """Get information about a particular comics.""" |
|
1110 | name = soup.find('meta', property='og:title')['content'] |
|
1111 | imgs = soup.find_all('meta', property='og:image') |
|
1112 | assert len(imgs) == 1, imgs |
|
1113 | return { |
|
1114 | 'name': name, |
|
1115 | 'img': [i['content'] for i in imgs], |
|
1116 | } |
|
1117 | ||
1118 |