@@ 2220-2240 (lines=21) @@ | ||
2217 | 'img': [i['content'] for i in imgs], |
|
2218 | } |
|
2219 | ||
2220 | ||
2221 | class TurnOffUs(GenericListableComic): |
|
2222 | """Class to retrieve TurnOffUs comics.""" |
|
2223 | name = 'turnoffus' |
|
2224 | long_name = 'Turn Off Us' |
|
2225 | url = 'http://turnoff.us' |
|
2226 | get_url_from_archive_element = join_cls_url_to_href |
|
2227 | ||
2228 | @classmethod |
|
2229 | def get_archive_elements(cls): |
|
2230 | archive_url = urljoin_wrapper(cls.url, 'all') |
|
2231 | post_list = get_soup_at_url(archive_url).find('ul', class_='post-list') |
|
2232 | return reversed(post_list.find_all('a', class_='post-link')) |
|
2233 | ||
2234 | @classmethod |
|
2235 | def get_comic_info(cls, soup, archive_elt): |
|
2236 | """Get information about a particular comics.""" |
|
2237 | title = soup.find('meta', property='og:title')['content'] |
|
2238 | imgs = soup.find_all('meta', property='og:image') |
|
2239 | return { |
|
2240 | 'title': title, |
|
2241 | 'img': [i['content'] for i in imgs], |
|
2242 | } |
|
2243 | ||
@@ 2909-2926 (lines=18) @@ | ||
2906 | 'title': imgs[0]['title'], |
|
2907 | } |
|
2908 | ||
2909 | ||
2910 | class GenericCommitStrip(GenericNavigableComic): |
|
2911 | """Generic class to retrieve Commit Strips in different languages.""" |
|
2912 | get_navi_link = get_a_rel_next |
|
2913 | get_first_comic_link = simulate_first_link |
|
2914 | first_url = NotImplemented |
|
2915 | ||
2916 | @classmethod |
|
2917 | def get_comic_info(cls, soup, link): |
|
2918 | """Get information about a particular comics.""" |
|
2919 | desc = soup.find('meta', property='og:description')['content'] |
|
2920 | title = soup.find('meta', property='og:title')['content'] |
|
2921 | imgs = soup.find('div', class_='entry-content').find_all('img') |
|
2922 | title2 = ' '.join(i.get('title', '') for i in imgs) |
|
2923 | return { |
|
2924 | 'title': title, |
|
2925 | 'title2': title2, |
|
2926 | 'description': desc, |
|
2927 | 'img': [urljoin_wrapper(cls.url, convert_iri_to_plain_ascii_uri(i['src'])) for i in imgs], |
|
2928 | } |
|
2929 |