| @@ 4666-4682 (lines=17) @@ | ||
| 4663 | link_re = NotImplemented |
|
| 4664 | get_url_from_archive_element = join_cls_url_to_href |
|
| 4665 | ||
| 4666 | @classmethod |
|
| 4667 | def get_comic_info(cls, soup, link): |
|
| 4668 | """Get information about a particular comics.""" |
|
| 4669 | href = link['href'] |
|
| 4670 | num = int(cls.link_re.match(href).groups()[0]) |
|
| 4671 | title = link.string |
|
| 4672 | imgs = soup.find_all('img', id='comic') |
|
| 4673 | assert len(imgs) == 1 |
|
| 4674 | year, month, day = [int(s) |
|
| 4675 | for s in cls.img_re.match(imgs[0]['src']).groups()] |
|
| 4676 | return { |
|
| 4677 | 'title': title, |
|
| 4678 | 'day': day, |
|
| 4679 | 'month': month, |
|
| 4680 | 'year': year, |
|
| 4681 | 'img': [i['src'] for i in imgs], |
|
| 4682 | 'num': num, |
|
| 4683 | } |
|
| 4684 | ||
| 4685 | @classmethod |
|
| @@ 763-778 (lines=16) @@ | ||
| 760 | get_navi_link = get_link_rel_next |
|
| 761 | get_url_from_link = join_cls_url_to_href |
|
| 762 | ||
| 763 | @classmethod |
|
| 764 | def get_comic_info(cls, soup, link): |
|
| 765 | """Get information about a particular comics.""" |
|
| 766 | short_url_re = re.compile('^%s/\\?p=([0-9]*)' % cls.url) |
|
| 767 | short_url = cls.get_url_from_link(soup.find('link', rel='shortlink')) |
|
| 768 | num = int(short_url_re.match(short_url).groups()[0]) |
|
| 769 | imgs = soup.find('div', id='comic').find_all('img') |
|
| 770 | assert len(imgs) == 1 |
|
| 771 | title = imgs[0]['alt'] |
|
| 772 | title2 = imgs[0]['title'] |
|
| 773 | return { |
|
| 774 | 'short_url': short_url, |
|
| 775 | 'title': title, |
|
| 776 | 'title2': title2, |
|
| 777 | 'img': [urljoin_wrapper(cls.url, i['src']) for i in imgs], |
|
| 778 | 'num': num, |
|
| 779 | } |
|
| 780 | ||
| 781 | ||