@@ 4312-4328 (lines=17) @@ | ||
4309 | link_re = NotImplemented |
|
4310 | get_url_from_archive_element = join_cls_url_to_href |
|
4311 | ||
4312 | @classmethod |
|
4313 | def get_comic_info(cls, soup, link): |
|
4314 | """Get information about a particular comics.""" |
|
4315 | href = link['href'] |
|
4316 | num = int(cls.link_re.match(href).groups()[0]) |
|
4317 | title = link.string |
|
4318 | imgs = soup.find_all('img', id='comic') |
|
4319 | assert len(imgs) == 1 |
|
4320 | year, month, day = [int(s) |
|
4321 | for s in cls.img_re.match(imgs[0]['src']).groups()] |
|
4322 | return { |
|
4323 | 'title': title, |
|
4324 | 'day': day, |
|
4325 | 'month': month, |
|
4326 | 'year': year, |
|
4327 | 'img': [i['src'] for i in imgs], |
|
4328 | 'num': num, |
|
4329 | } |
|
4330 | ||
4331 | @classmethod |
|
@@ 730-745 (lines=16) @@ | ||
727 | get_navi_link = get_link_rel_next |
|
728 | get_url_from_link = join_cls_url_to_href |
|
729 | ||
730 | @classmethod |
|
731 | def get_comic_info(cls, soup, link): |
|
732 | """Get information about a particular comics.""" |
|
733 | short_url_re = re.compile('^%s/\\?p=([0-9]*)' % cls.url) |
|
734 | short_url = cls.get_url_from_link(soup.find('link', rel='shortlink')) |
|
735 | num = int(short_url_re.match(short_url).groups()[0]) |
|
736 | imgs = soup.find('div', id='comic').find_all('img') |
|
737 | assert len(imgs) == 1 |
|
738 | title = imgs[0]['alt'] |
|
739 | title2 = imgs[0]['title'] |
|
740 | return { |
|
741 | 'short_url': short_url, |
|
742 | 'title': title, |
|
743 | 'title2': title2, |
|
744 | 'img': [urljoin_wrapper(cls.url, i['src']) for i in imgs], |
|
745 | 'num': num, |
|
746 | } |
|
747 | ||
748 |