@@ 3191-3214 (lines=24) @@ | ||
3188 | long_name = 'consolia' |
|
3189 | url = 'https://consolia-comic.com' |
|
3190 | get_url_from_link = join_cls_url_to_href |
|
3191 | ||
3192 | @classmethod |
|
3193 | def get_first_comic_link(cls): |
|
3194 | """Get link to first comics.""" |
|
3195 | return get_soup_at_url(cls.url).find('span', class_='first').find('a') |
|
3196 | ||
3197 | @classmethod |
|
3198 | def get_navi_link(cls, last_soup, next_): |
|
3199 | """Get link to next or previous comic.""" |
|
3200 | return last_soup.find('span', class_='next' if next_ else 'prev').find('a') |
|
3201 | ||
3202 | @classmethod |
|
3203 | def get_comic_info(cls, soup, link): |
|
3204 | """Get information about a particular comics.""" |
|
3205 | title = soup.find('meta', property='og:title')['content'] |
|
3206 | date_str = soup.find('time')["datetime"] |
|
3207 | day = string_to_date(date_str, "%Y-%m-%d") |
|
3208 | imgs = soup.find('div', id='comic').find_all('img') |
|
3209 | alt = imgs[0]['title'] |
|
3210 | # article = soup.find('div', id='blag') |
|
3211 | # text = article.encode_contents() |
|
3212 | return { |
|
3213 | 'title': title, |
|
3214 | 'alt': alt, |
|
3215 | 'img': [i['src'] for i in imgs], |
|
3216 | # 'text': text, |
|
3217 | 'day': day.day, |
|
@@ 3124-3147 (lines=24) @@ | ||
3121 | """Get link to first comics.""" |
|
3122 | return get_soup_at_url(cls.url).find('span', class_='glyphicon glyphicon-backward').parent |
|
3123 | ||
3124 | @classmethod |
|
3125 | def get_navi_link(cls, last_soup, next_): |
|
3126 | """Get link to next or previous comic.""" |
|
3127 | class_ = 'glyphicon glyphicon-chevron-' + ('right' if next_ else 'left') |
|
3128 | return last_soup.find('span', class_=class_).parent |
|
3129 | ||
3130 | @classmethod |
|
3131 | def get_comic_info(cls, soup, link): |
|
3132 | """Get information about a particular comics.""" |
|
3133 | title = soup.find('meta', attrs={'name': 'twitter:title'})['content'] |
|
3134 | url2 = soup.find('meta', attrs={'name': 'twitter:url'})['content'] |
|
3135 | # date_str = soup.find('h2', class_='comic_title').find('small').string |
|
3136 | # day = string_to_date(date_str, "%B %d, %Y, %I:%M %p") |
|
3137 | imgs = soup.find_all('img', class_='comic img-responsive') |
|
3138 | title2 = imgs[0]['title'] |
|
3139 | alt = imgs[0]['alt'] |
|
3140 | return { |
|
3141 | 'url2': url2, |
|
3142 | 'title': title, |
|
3143 | 'title2': title2, |
|
3144 | 'alt': alt, |
|
3145 | 'img': [i['src'] for i in imgs], |
|
3146 | } |
|
3147 | ||
3148 | ||
3149 | class MakeItStoopid(GenericNavigableComic): |
|
3150 | """Class to retrieve Make It Stoopid Comics.""" |