@@ 2177-2197 (lines=21) @@ | ||
2174 | ||
2175 | class TurnOffUs(GenericListableComic): |
|
2176 | """Class to retrieve TurnOffUs comics.""" |
|
2177 | name = 'turnoffus' |
|
2178 | long_name = 'Turn Off Us' |
|
2179 | url = 'http://turnoff.us' |
|
2180 | get_url_from_archive_element = join_cls_url_to_href |
|
2181 | ||
2182 | @classmethod |
|
2183 | def get_archive_elements(cls): |
|
2184 | archive_url = urljoin_wrapper(cls.url, 'all') |
|
2185 | post_list = get_soup_at_url(archive_url).find('ul', class_='post-list') |
|
2186 | return reversed(post_list.find_all('a', class_='post-link')) |
|
2187 | ||
2188 | @classmethod |
|
2189 | def get_comic_info(cls, soup, archive_elt): |
|
2190 | """Get information about a particular comics.""" |
|
2191 | title = soup.find('meta', property='og:title')['content'] |
|
2192 | imgs = soup.find_all('meta', property='og:image') |
|
2193 | return { |
|
2194 | 'title': title, |
|
2195 | 'img': [i['content'] for i in imgs], |
|
2196 | } |
|
2197 | ||
2198 | ||
2199 | class ThingsInSquares(GenericListableComic): |
|
2200 | """Class to retrieve Things In Squares comics.""" |
|
@@ 2805-2822 (lines=18) @@ | ||
2802 | ||
2803 | class GenericCommitStrip(GenericNavigableComic): |
|
2804 | """Generic class to retrieve Commit Strips in different languages.""" |
|
2805 | get_navi_link = get_a_rel_next |
|
2806 | get_first_comic_link = simulate_first_link |
|
2807 | first_url = NotImplemented |
|
2808 | ||
2809 | @classmethod |
|
2810 | def get_comic_info(cls, soup, link): |
|
2811 | """Get information about a particular comics.""" |
|
2812 | desc = soup.find('meta', property='og:description')['content'] |
|
2813 | title = soup.find('meta', property='og:title')['content'] |
|
2814 | imgs = soup.find('div', class_='entry-content').find_all('img') |
|
2815 | title2 = ' '.join(i.get('title', '') for i in imgs) |
|
2816 | return { |
|
2817 | 'title': title, |
|
2818 | 'title2': title2, |
|
2819 | 'description': desc, |
|
2820 | 'img': [urljoin_wrapper(cls.url, convert_iri_to_plain_ascii_uri(i['src'])) for i in imgs], |
|
2821 | } |
|
2822 | ||
2823 | ||
2824 | class CommitStripFr(GenericCommitStrip): |
|
2825 | """Class to retrieve Commit Strips in French.""" |