@@ 2028-2051 (lines=24) @@ | ||
2025 | } |
|
2026 | ||
2027 | ||
2028 | class PoorlyDrawnLines(GenericListableComic): |
|
2029 | """Class to retrieve Poorly Drawn Lines comics.""" |
|
2030 | # Also on http://pdlcomics.tumblr.com |
|
2031 | name = 'poorlydrawn' |
|
2032 | long_name = 'Poorly Drawn Lines' |
|
2033 | url = 'https://www.poorlydrawnlines.com' |
|
2034 | _categories = ('POORLYDRAWN', ) |
|
2035 | get_url_from_archive_element = get_href |
|
2036 | ||
2037 | @classmethod |
|
2038 | def get_comic_info(cls, soup, link): |
|
2039 | """Get information about a particular comics.""" |
|
2040 | imgs = soup.find('div', class_='post').find_all('img') |
|
2041 | assert len(imgs) <= 1 |
|
2042 | return { |
|
2043 | 'img': [i['src'] for i in imgs], |
|
2044 | 'title': imgs[0].get('title', "") if imgs else "", |
|
2045 | } |
|
2046 | ||
2047 | @classmethod |
|
2048 | def get_archive_elements(cls): |
|
2049 | archive_url = urljoin_wrapper(cls.url, 'archive') |
|
2050 | url_re = re.compile('^%s/comic/.' % cls.url) |
|
2051 | return reversed(get_soup_at_url(archive_url).find_all('a', href=url_re)) |
|
2052 | ||
2053 | ||
2054 | class LoadingComics(GenericNavigableComic): |
|
@@ 1049-1070 (lines=22) @@ | ||
1046 | } |
|
1047 | ||
1048 | ||
1049 | class PerryBibleFellowship(GenericListableComic): # Is now navigable too |
|
1050 | """Class to retrieve Perry Bible Fellowship comics.""" |
|
1051 | name = 'pbf' |
|
1052 | long_name = 'Perry Bible Fellowship' |
|
1053 | url = 'http://pbfcomics.com' |
|
1054 | get_url_from_archive_element = join_cls_url_to_href |
|
1055 | ||
1056 | @classmethod |
|
1057 | def get_archive_elements(cls): |
|
1058 | soup = get_soup_at_url(cls.url) |
|
1059 | thumbnails = soup.find('div', id='all_thumbnails') |
|
1060 | return reversed(thumbnails.find_all('a')) |
|
1061 | ||
1062 | @classmethod |
|
1063 | def get_comic_info(cls, soup, link): |
|
1064 | """Get information about a particular comics.""" |
|
1065 | name = soup.find('meta', property='og:title')['content'] |
|
1066 | imgs = soup.find_all('meta', property='og:image') |
|
1067 | assert len(imgs) == 1 |
|
1068 | return { |
|
1069 | 'name': name, |
|
1070 | 'img': [i['content'] for i in imgs], |
|
1071 | } |
|
1072 | ||
1073 |