|
@@ 2223-2242 (lines=20) @@
|
| 2220 |
|
|
| 2221 |
|
class FatAwesomeComics(GenericNavigableComic): |
| 2222 |
|
"""Class to retrieve Fat Awesome Comics.""" |
| 2223 |
|
# Also on http://fatawesomecomedy.tumblr.com |
| 2224 |
|
name = 'fatawesome' |
| 2225 |
|
long_name = 'Fat Awesome' |
| 2226 |
|
url = 'http://fatawesome.com/comics' |
| 2227 |
|
get_navi_link = get_a_rel_next |
| 2228 |
|
get_first_comic_link = simulate_first_link |
| 2229 |
|
first_url = 'http://fatawesome.com/shortbus/' |
| 2230 |
|
|
| 2231 |
|
@classmethod |
| 2232 |
|
def get_comic_info(cls, soup, link): |
| 2233 |
|
"""Get information about a particular comics.""" |
| 2234 |
|
title = soup.find('meta', attrs={'name': 'twitter:title'})['content'] |
| 2235 |
|
description = soup.find('meta', attrs={'name': 'description'})['content'] |
| 2236 |
|
tags_prop = soup.find('meta', property='article:tag') |
| 2237 |
|
tags = tags_prop['content'] if tags_prop else "" |
| 2238 |
|
date_str = soup.find('meta', property='article:published_time')['content'][:10] |
| 2239 |
|
day = string_to_date(date_str, "%Y-%m-%d") |
| 2240 |
|
imgs = soup.find_all('img', attrs={'data-recalc-dims': "1"}) |
| 2241 |
|
assert len(imgs) == 1 |
| 2242 |
|
return { |
| 2243 |
|
'title': title, |
| 2244 |
|
'description': description, |
| 2245 |
|
'tags': tags, |
|
@@ 1914-1932 (lines=19) @@
|
| 1911 |
|
@classmethod |
| 1912 |
|
def get_comic_info(cls, soup, link): |
| 1913 |
|
"""Get information about a particular comics.""" |
| 1914 |
|
comic_img_re = re.compile('^dhdcomics/.*') |
| 1915 |
|
img = soup.find('img', src=comic_img_re) |
| 1916 |
|
comic_url = cls.get_url_from_link(link) |
| 1917 |
|
return { |
| 1918 |
|
'title': soup.find('h2', id='titleheader').string, |
| 1919 |
|
'title2': soup.find('div', id='subtext').string, |
| 1920 |
|
'alt': img.get('title'), |
| 1921 |
|
'img': [urljoin_wrapper(comic_url, img['src'].strip())], |
| 1922 |
|
'num': int(comic_url.split('/')[-1]), |
| 1923 |
|
} |
| 1924 |
|
|
| 1925 |
|
|
| 1926 |
|
class InvisibleBread(GenericListableComic): |
| 1927 |
|
"""Class to retrieve Invisible Bread comics.""" |
| 1928 |
|
# Also on http://www.gocomics.com/invisible-bread |
| 1929 |
|
name = 'invisiblebread' |
| 1930 |
|
long_name = 'Invisible Bread' |
| 1931 |
|
url = 'http://invisiblebread.com' |
| 1932 |
|
|
| 1933 |
|
@classmethod |
| 1934 |
|
def get_archive_elements(cls): |
| 1935 |
|
archive_url = urljoin_wrapper(cls.url, 'archives/') |