|
@@ 1456-1486 (lines=31) @@
|
| 1453 |
|
'title': title, |
| 1454 |
|
} |
| 1455 |
|
|
| 1456 |
|
|
| 1457 |
|
class Octopuns(GenericEmptyComic, GenericNavigableComic): |
| 1458 |
|
"""Class to retrieve Octopuns comics.""" |
| 1459 |
|
# Also on http://octopuns.tumblr.com |
| 1460 |
|
name = 'octopuns' |
| 1461 |
|
long_name = 'Octopuns' |
| 1462 |
|
url = 'http://www.octopuns.net' |
| 1463 |
|
|
| 1464 |
|
@classmethod |
| 1465 |
|
def get_first_comic_link(cls): |
| 1466 |
|
"""Get link to first comics.""" |
| 1467 |
|
return get_soup_at_url(cls.url).find('img', src=re.compile('.*/First.png')).parent |
| 1468 |
|
|
| 1469 |
|
@classmethod |
| 1470 |
|
def get_navi_link(cls, last_soup, next_): |
| 1471 |
|
"""Get link to next or previous comic.""" |
| 1472 |
|
link = last_soup.find('img', src=re.compile('.*/Next.png' if next_ else '.*/Back.png')).parent |
| 1473 |
|
return None if link.get('href') is None else link |
| 1474 |
|
|
| 1475 |
|
@classmethod |
| 1476 |
|
def get_comic_info(cls, soup, link): |
| 1477 |
|
"""Get information about a particular comics.""" |
| 1478 |
|
title = soup.find('h3', class_='post-title entry-title').string |
| 1479 |
|
date_str = soup.find('h2', class_='date-header').string |
| 1480 |
|
day = string_to_date(date_str, "%A, %B %d, %Y") |
| 1481 |
|
imgs = soup.find_all('link', rel='image_src') |
| 1482 |
|
return { |
| 1483 |
|
'img': [i['href'] for i in imgs], |
| 1484 |
|
'title': title, |
| 1485 |
|
'day': day.day, |
| 1486 |
|
'month': day.month, |
| 1487 |
|
'year': day.year, |
| 1488 |
|
} |
| 1489 |
|
|
|
@@ 2036-2064 (lines=29) @@
|
| 2033 |
|
url_re = re.compile('^%s/comic/.' % cls.url) |
| 2034 |
|
return reversed(get_soup_at_url(archive_url).find_all('a', href=url_re)) |
| 2035 |
|
|
| 2036 |
|
|
| 2037 |
|
class LoadingComics(GenericNavigableComic): |
| 2038 |
|
"""Class to retrieve Loading Artist comics.""" |
| 2039 |
|
name = 'loadingartist' |
| 2040 |
|
long_name = 'Loading Artist' |
| 2041 |
|
url = 'http://www.loadingartist.com/latest' |
| 2042 |
|
|
| 2043 |
|
@classmethod |
| 2044 |
|
def get_first_comic_link(cls): |
| 2045 |
|
"""Get link to first comics.""" |
| 2046 |
|
return get_soup_at_url(cls.url).find('a', title="First") |
| 2047 |
|
|
| 2048 |
|
@classmethod |
| 2049 |
|
def get_navi_link(cls, last_soup, next_): |
| 2050 |
|
"""Get link to next or previous comic.""" |
| 2051 |
|
return last_soup.find('a', title='Next' if next_ else 'Previous') |
| 2052 |
|
|
| 2053 |
|
@classmethod |
| 2054 |
|
def get_comic_info(cls, soup, link): |
| 2055 |
|
"""Get information about a particular comics.""" |
| 2056 |
|
title = soup.find('h1').string |
| 2057 |
|
date_str = soup.find('span', class_='date').string.strip() |
| 2058 |
|
day = string_to_date(date_str, "%B %d, %Y") |
| 2059 |
|
imgs = soup.find('div', class_='comic').find_all('img', alt='', title='') |
| 2060 |
|
return { |
| 2061 |
|
'title': title, |
| 2062 |
|
'img': [i['src'] for i in imgs], |
| 2063 |
|
'month': day.month, |
| 2064 |
|
'year': day.year, |
| 2065 |
|
'day': day.day, |
| 2066 |
|
} |
| 2067 |
|
|