|
@@ 1789-1817 (lines=29) @@
|
| 1786 |
|
} |
| 1787 |
|
|
| 1788 |
|
|
| 1789 |
|
class SafelyEndangered(GenericNavigableComic): |
| 1790 |
|
"""Class to retrieve Safely Endangered comics.""" |
| 1791 |
|
# Also on http://tumblr.safelyendangered.com |
| 1792 |
|
name = 'endangered' |
| 1793 |
|
long_name = 'Safely Endangered' |
| 1794 |
|
url = 'http://www.safelyendangered.com' |
| 1795 |
|
get_navi_link = get_link_rel_next |
| 1796 |
|
|
| 1797 |
|
@classmethod |
| 1798 |
|
def get_first_comic_link(cls): |
| 1799 |
|
"""Get link to first comics.""" |
| 1800 |
|
return {'href': 'http://www.safelyendangered.com/comic/ignored/'} |
| 1801 |
|
|
| 1802 |
|
@classmethod |
| 1803 |
|
def get_comic_info(cls, soup, link): |
| 1804 |
|
"""Get information about a particular comics.""" |
| 1805 |
|
title = soup.find('h2', class_='post-title').string |
| 1806 |
|
date_str = soup.find('span', class_='post-date').string |
| 1807 |
|
day = string_to_date(date_str, '%B %d, %Y') |
| 1808 |
|
imgs = soup.find('div', id='comic').find_all('img') |
| 1809 |
|
alt = imgs[0]['alt'] |
| 1810 |
|
assert all(i['alt'] == i['title'] for i in imgs) |
| 1811 |
|
return { |
| 1812 |
|
'day': day.day, |
| 1813 |
|
'month': day.month, |
| 1814 |
|
'year': day.year, |
| 1815 |
|
'img': [i['src'] for i in imgs], |
| 1816 |
|
'title': title, |
| 1817 |
|
'alt': alt, |
| 1818 |
|
} |
| 1819 |
|
|
| 1820 |
|
|
|
@@ 2263-2288 (lines=26) @@
|
| 2260 |
|
} |
| 2261 |
|
|
| 2262 |
|
|
| 2263 |
|
class LinsEditions(GenericNavigableComic): |
| 2264 |
|
"""Class to retrieve L.I.N.S. Editions comics.""" |
| 2265 |
|
# Also on http://linscomics.tumblr.com |
| 2266 |
|
name = 'lins' |
| 2267 |
|
long_name = 'L.I.N.S. Editions' |
| 2268 |
|
url = 'https://linsedition.com' |
| 2269 |
|
get_navi_link = get_link_rel_next |
| 2270 |
|
|
| 2271 |
|
@classmethod |
| 2272 |
|
def get_first_comic_link(cls): |
| 2273 |
|
"""Get link to first comics.""" |
| 2274 |
|
return {'href': 'https://linsedition.com/2011/09/07/l-i-n-s/'} |
| 2275 |
|
|
| 2276 |
|
@classmethod |
| 2277 |
|
def get_comic_info(cls, soup, link): |
| 2278 |
|
"""Get information about a particular comics.""" |
| 2279 |
|
title = soup.find('meta', property='og:title')['content'] |
| 2280 |
|
imgs = soup.find_all('meta', property='og:image') |
| 2281 |
|
date_str = soup.find('meta', property='article:published_time')['content'][:10] |
| 2282 |
|
day = string_to_date(date_str, "%Y-%m-%d") |
| 2283 |
|
return { |
| 2284 |
|
'title': title, |
| 2285 |
|
'img': [i['content'] for i in imgs], |
| 2286 |
|
'month': day.month, |
| 2287 |
|
'year': day.year, |
| 2288 |
|
'day': day.day, |
| 2289 |
|
} |
| 2290 |
|
|
| 2291 |
|
|