@@ 324-352 (lines=29) @@ | ||
321 | } |
|
322 | ||
323 | ||
324 | class GenericLeMondeBlog(GenericNavigableComic): |
|
325 | """Generic class to retrieve comics from Le Monde blogs.""" |
|
326 | get_navi_link = get_link_rel_next |
|
327 | ||
328 | @classmethod |
|
329 | def get_first_comic_url(cls): |
|
330 | """Get first comic url.""" |
|
331 | raise NotImplementedError |
|
332 | ||
333 | @classmethod |
|
334 | def get_first_comic_link(cls): |
|
335 | """Get link to first comics.""" |
|
336 | return {'href': cls.get_first_comic_url()} |
|
337 | ||
338 | @classmethod |
|
339 | def get_comic_info(cls, soup, link): |
|
340 | """Get information about a particular comics.""" |
|
341 | url2 = soup.find('link', rel='shortlink')['href'] |
|
342 | title = soup.find('meta', property='og:title')['content'] |
|
343 | date_str = soup.find("span", class_="entry-date").string |
|
344 | day = string_to_date(date_str, "%d %B %Y", "fr_FR.utf8") |
|
345 | imgs = soup.find_all('meta', property='og:image') |
|
346 | return { |
|
347 | 'title': title, |
|
348 | 'url2': url2, |
|
349 | 'img': [convert_iri_to_plain_ascii_uri(i['content']) for i in imgs], |
|
350 | 'month': day.month, |
|
351 | 'year': day.year, |
|
352 | 'day': day.day, |
|
353 | } |
|
354 | ||
355 | ||
@@ 2938-2959 (lines=22) @@ | ||
2935 | } |
|
2936 | ||
2937 | ||
2938 | class GenericWordPressInkblot(GenericNavigableComic): |
|
2939 | """Generic class to retrieve comics using WordPress with Inkblot.""" |
|
2940 | get_navi_link = get_link_rel_next |
|
2941 | ||
2942 | @classmethod |
|
2943 | def get_first_comic_link(cls): |
|
2944 | """Get link to first comics.""" |
|
2945 | return get_soup_at_url(cls.url).find('a', class_='webcomic-link webcomic1-link first-webcomic-link first-webcomic1-link') |
|
2946 | ||
2947 | @classmethod |
|
2948 | def get_comic_info(cls, soup, link): |
|
2949 | """Get information about a particular comics.""" |
|
2950 | title = soup.find('meta', property='og:title')['content'] |
|
2951 | imgs = soup.find('div', class_='webcomic-image').find_all('img') |
|
2952 | date_str = soup.find('meta', property='article:published_time')['content'][:10] |
|
2953 | day = string_to_date(date_str, "%Y-%m-%d") |
|
2954 | return { |
|
2955 | 'title': title, |
|
2956 | 'day': day.day, |
|
2957 | 'month': day.month, |
|
2958 | 'year': day.year, |
|
2959 | 'img': [i['src'] for i in imgs], |
|
2960 | } |
|
2961 | ||
2962 |