@@ 2193-2213 (lines=21) @@ | ||
2190 | } |
|
2191 | ||
2192 | ||
2193 | class TurnOffUs(GenericListableComic): |
|
2194 | """Class to retrieve TurnOffUs comics.""" |
|
2195 | name = 'turnoffus' |
|
2196 | long_name = 'Turn Off Us' |
|
2197 | url = 'http://turnoff.us' |
|
2198 | get_url_from_archive_element = join_cls_url_to_href |
|
2199 | ||
2200 | @classmethod |
|
2201 | def get_archive_elements(cls): |
|
2202 | archive_url = urljoin_wrapper(cls.url, 'all') |
|
2203 | post_list = get_soup_at_url(archive_url).find('ul', class_='post-list') |
|
2204 | return reversed(post_list.find_all('a', class_='post-link')) |
|
2205 | ||
2206 | @classmethod |
|
2207 | def get_comic_info(cls, soup, archive_elt): |
|
2208 | """Get information about a particular comics.""" |
|
2209 | title = soup.find('meta', property='og:title')['content'] |
|
2210 | imgs = soup.find_all('meta', property='og:image') |
|
2211 | return { |
|
2212 | 'title': title, |
|
2213 | 'img': [i['content'] for i in imgs], |
|
2214 | } |
|
2215 | ||
2216 | ||
@@ 2845-2862 (lines=18) @@ | ||
2842 | } |
|
2843 | ||
2844 | ||
2845 | class GenericCommitStrip(GenericNavigableComic): |
|
2846 | """Generic class to retrieve Commit Strips in different languages.""" |
|
2847 | get_navi_link = get_a_rel_next |
|
2848 | get_first_comic_link = simulate_first_link |
|
2849 | first_url = NotImplemented |
|
2850 | ||
2851 | @classmethod |
|
2852 | def get_comic_info(cls, soup, link): |
|
2853 | """Get information about a particular comics.""" |
|
2854 | desc = soup.find('meta', property='og:description')['content'] |
|
2855 | title = soup.find('meta', property='og:title')['content'] |
|
2856 | imgs = soup.find('div', class_='entry-content').find_all('img') |
|
2857 | title2 = ' '.join(i.get('title', '') for i in imgs) |
|
2858 | return { |
|
2859 | 'title': title, |
|
2860 | 'title2': title2, |
|
2861 | 'description': desc, |
|
2862 | 'img': [urljoin_wrapper(cls.url, convert_iri_to_plain_ascii_uri(i['src'])) for i in imgs], |
|
2863 | } |
|
2864 | ||
2865 |