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