|
@@ 2875-2889 (lines=15) @@
|
| 2872 |
|
# prev is next / next is prev |
| 2873 |
|
return last_soup.find('li', class_='previous' if next_ else 'next').find('a') |
| 2874 |
|
|
| 2875 |
|
@classmethod |
| 2876 |
|
def get_comic_info(cls, soup, link): |
| 2877 |
|
"""Get information about a particular comics.""" |
| 2878 |
|
date_str = soup.find('time', class_='published')['datetime'] |
| 2879 |
|
day = string_to_date(date_str, "%Y-%m-%d") |
| 2880 |
|
author = soup.find('span', class_='blog-author').find('a').string |
| 2881 |
|
title = soup.find('meta', property='og:title')['content'] |
| 2882 |
|
imgs = soup.find_all('meta', itemprop='image') |
| 2883 |
|
return { |
| 2884 |
|
'img': [i['content'] for i in imgs], |
| 2885 |
|
'title': title, |
| 2886 |
|
'author': author, |
| 2887 |
|
'day': day.day, |
| 2888 |
|
'month': day.month, |
| 2889 |
|
'year': day.year, |
| 2890 |
|
} |
| 2891 |
|
|
| 2892 |
|
|
|
@@ 393-407 (lines=15) @@
|
| 390 |
|
get_first_comic_link = simulate_first_link |
| 391 |
|
first_url = NotImplemented |
| 392 |
|
|
| 393 |
|
@classmethod |
| 394 |
|
def get_comic_info(cls, soup, link): |
| 395 |
|
"""Get information about a particular comics.""" |
| 396 |
|
url2 = soup.find('link', rel='shortlink')['href'] |
| 397 |
|
title = soup.find('meta', property='og:title')['content'] |
| 398 |
|
date_str = soup.find("span", class_="entry-date").string |
| 399 |
|
day = string_to_date(date_str, "%d %B %Y", "fr_FR.utf8") |
| 400 |
|
imgs = soup.find_all('meta', property='og:image') |
| 401 |
|
return { |
| 402 |
|
'title': title, |
| 403 |
|
'url2': url2, |
| 404 |
|
'img': [convert_iri_to_plain_ascii_uri(i['content']) for i in imgs], |
| 405 |
|
'month': day.month, |
| 406 |
|
'year': day.year, |
| 407 |
|
'day': day.day, |
| 408 |
|
} |
| 409 |
|
|
| 410 |
|
|
|
@@ 934-947 (lines=14) @@
|
| 931 |
|
"""Get link to first comics.""" |
| 932 |
|
return get_soup_at_url(cls.url).find('a', class_='comic_nav_link first_comic_link') |
| 933 |
|
|
| 934 |
|
@classmethod |
| 935 |
|
def get_comic_info(cls, soup, link): |
| 936 |
|
"""Get information about a particular comics.""" |
| 937 |
|
title = soup.find("h1", class_="comic_title").string |
| 938 |
|
date_str = soup.find("span", class_="comic_date").string |
| 939 |
|
day = string_to_date(date_str, "%B %d, %Y") |
| 940 |
|
imgs = soup.find_all("img", class_="comic") |
| 941 |
|
assert all(i['alt'] == i['title'] == title for i in imgs) |
| 942 |
|
return { |
| 943 |
|
'title': title, |
| 944 |
|
'img': [i['src'] for i in imgs if i["src"]], |
| 945 |
|
'day': day.day, |
| 946 |
|
'month': day.month, |
| 947 |
|
'year': day.year |
| 948 |
|
} |
| 949 |
|
|
| 950 |
|
|
|
@@ 2942-2954 (lines=13) @@
|
| 2939 |
|
"""Get link to first comics.""" |
| 2940 |
|
return get_soup_at_url(cls.url).find('a', class_='webcomic-link webcomic1-link first-webcomic-link first-webcomic1-link') |
| 2941 |
|
|
| 2942 |
|
@classmethod |
| 2943 |
|
def get_comic_info(cls, soup, link): |
| 2944 |
|
"""Get information about a particular comics.""" |
| 2945 |
|
title = soup.find('meta', property='og:title')['content'] |
| 2946 |
|
imgs = soup.find('div', class_='webcomic-image').find_all('img') |
| 2947 |
|
date_str = soup.find('meta', property='article:published_time')['content'][:10] |
| 2948 |
|
day = string_to_date(date_str, "%Y-%m-%d") |
| 2949 |
|
return { |
| 2950 |
|
'title': title, |
| 2951 |
|
'day': day.day, |
| 2952 |
|
'month': day.month, |
| 2953 |
|
'year': day.year, |
| 2954 |
|
'img': [i['src'] for i in imgs], |
| 2955 |
|
} |
| 2956 |
|
|
| 2957 |
|
|