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