@@ 2737-2767 (lines=31) @@ | ||
2734 | lang = "fr_FR.utf8" |
|
2735 | ||
2736 | ||
2737 | class UnearthedComics(GenericNavigableComic): |
|
2738 | """Class to retrieve Unearthed comics.""" |
|
2739 | # Also on http://tapastic.com/series/UnearthedComics |
|
2740 | # Also on http://unearthedcomics.tumblr.com |
|
2741 | name = 'unearthed' |
|
2742 | long_name = 'Unearthed Comics' |
|
2743 | url = 'http://unearthedcomics.com' |
|
2744 | _categories = ('UNEARTHED', ) |
|
2745 | get_navi_link = get_link_rel_next |
|
2746 | get_first_comic_link = simulate_first_link |
|
2747 | first_url = 'http://unearthedcomics.com/comics/world-with-turn-signals/' |
|
2748 | ||
2749 | @classmethod |
|
2750 | def get_comic_info(cls, soup, link): |
|
2751 | """Get information about a particular comics.""" |
|
2752 | short_url = soup.find('link', rel='shortlink')['href'] |
|
2753 | title_elt = soup.find('h1') or soup.find('h2') |
|
2754 | title = title_elt.string if title_elt else "" |
|
2755 | desc = soup.find('meta', property='og:description') |
|
2756 | date_str = soup.find('time', class_='published updated hidden')['datetime'] |
|
2757 | day = string_to_date(date_str, "%Y-%m-%d") |
|
2758 | post = soup.find('div', class_="entry content entry-content type-portfolio") |
|
2759 | imgs = post.find_all('img') |
|
2760 | return { |
|
2761 | 'title': title, |
|
2762 | 'description': desc, |
|
2763 | 'url2': short_url, |
|
2764 | 'img': [i['src'] for i in imgs], |
|
2765 | 'month': day.month, |
|
2766 | 'year': day.year, |
|
2767 | 'day': day.day, |
|
2768 | } |
|
2769 | ||
2770 | ||
@@ 459-488 (lines=30) @@ | ||
456 | first_url = "http://uneanneeaulycee.blog.lemonde.fr/2016/06/13/la-semaine-du-bac-est-arrivee/" |
|
457 | ||
458 | ||
459 | class Rall(GenericNavigableComic): |
|
460 | """Class to retrieve Ted Rall comics.""" |
|
461 | # Also on http://www.gocomics.com/tedrall |
|
462 | name = 'rall' |
|
463 | long_name = "Ted Rall" |
|
464 | url = "http://rall.com/comic" |
|
465 | _categories = ('RALL', ) |
|
466 | get_navi_link = get_link_rel_next |
|
467 | get_first_comic_link = simulate_first_link |
|
468 | # Not the first but I didn't find an efficient way to retrieve it |
|
469 | first_url = "http://rall.com/2014/01/30/los-angeles-times-cartoon-well-miss-those-california-flowers" |
|
470 | ||
471 | @classmethod |
|
472 | def get_comic_info(cls, soup, link): |
|
473 | """Get information about a particular comics.""" |
|
474 | title = soup.find('meta', property='og:title')['content'] |
|
475 | author = soup.find("span", class_="author vcard").find("a").string |
|
476 | date_str = soup.find("span", class_="entry-date").string |
|
477 | day = string_to_date(date_str, "%B %d, %Y") |
|
478 | desc = soup.find('meta', property='og:description')['content'] |
|
479 | imgs = soup.find('div', class_='entry-content').find_all('img') |
|
480 | imgs = imgs[:-7] # remove social media buttons |
|
481 | return { |
|
482 | 'title': title, |
|
483 | 'author': author, |
|
484 | 'month': day.month, |
|
485 | 'year': day.year, |
|
486 | 'day': day.day, |
|
487 | 'description': desc, |
|
488 | 'img': [i['src'] for i in imgs], |
|
489 | } |
|
490 | ||
491 |