@@ 5074-5090 (lines=17) @@ | ||
5071 | link_re = NotImplemented |
|
5072 | get_url_from_archive_element = join_cls_url_to_href |
|
5073 | ||
5074 | @classmethod |
|
5075 | def get_comic_info(cls, soup, link): |
|
5076 | """Get information about a particular comics.""" |
|
5077 | href = link['href'] |
|
5078 | num = int(cls.link_re.match(href).groups()[0]) |
|
5079 | title = link.string |
|
5080 | imgs = soup.find_all('img', id='comic') |
|
5081 | assert len(imgs) == 1, imgs |
|
5082 | year, month, day = [int(s) |
|
5083 | for s in cls.img_re.match(imgs[0]['src']).groups()] |
|
5084 | return { |
|
5085 | 'title': title, |
|
5086 | 'day': day, |
|
5087 | 'month': month, |
|
5088 | 'year': year, |
|
5089 | 'img': [i['src'] for i in imgs], |
|
5090 | 'num': num, |
|
5091 | } |
|
5092 | ||
5093 | @classmethod |
|
@@ 808-823 (lines=16) @@ | ||
805 | get_navi_link = get_link_rel_next |
|
806 | get_url_from_link = join_cls_url_to_href |
|
807 | ||
808 | @classmethod |
|
809 | def get_comic_info(cls, soup, link): |
|
810 | """Get information about a particular comics.""" |
|
811 | short_url_re = re.compile('^%s/\\?p=([0-9]*)' % cls.url) |
|
812 | short_url = cls.get_url_from_link(soup.find('link', rel='shortlink')) |
|
813 | num = int(short_url_re.match(short_url).groups()[0]) |
|
814 | imgs = soup.find('div', id='comic').find_all('img') |
|
815 | assert len(imgs) == 1, imgs |
|
816 | title = imgs[0]['alt'] |
|
817 | title2 = imgs[0]['title'] |
|
818 | return { |
|
819 | 'short_url': short_url, |
|
820 | 'title': title, |
|
821 | 'title2': title2, |
|
822 | 'img': [urljoin_wrapper(cls.url, i['src']) for i in imgs], |
|
823 | 'num': num, |
|
824 | } |
|
825 | ||
826 |