@@ 2701-2730 (lines=30) @@ | ||
2698 | lang = "fr_FR.utf8" |
|
2699 | ||
2700 | ||
2701 | class UnearthedComics(GenericNavigableComic): |
|
2702 | """Class to retrieve Unearthed comics.""" |
|
2703 | # Also on http://tapastic.com/series/UnearthedComics |
|
2704 | # Also on http://unearthedcomics.tumblr.com |
|
2705 | name = 'unearthed' |
|
2706 | long_name = 'Unearthed Comics' |
|
2707 | url = 'http://unearthedcomics.com' |
|
2708 | get_navi_link = get_link_rel_next |
|
2709 | get_first_comic_link = simulate_first_link |
|
2710 | first_url = 'http://unearthedcomics.com/comics/world-with-turn-signals/' |
|
2711 | ||
2712 | @classmethod |
|
2713 | def get_comic_info(cls, soup, link): |
|
2714 | """Get information about a particular comics.""" |
|
2715 | short_url = soup.find('link', rel='shortlink')['href'] |
|
2716 | title_elt = soup.find('h1') or soup.find('h2') |
|
2717 | title = title_elt.string if title_elt else "" |
|
2718 | desc = soup.find('meta', property='og:description') |
|
2719 | date_str = soup.find('time', class_='published updated hidden')['datetime'] |
|
2720 | day = string_to_date(date_str, "%Y-%m-%d") |
|
2721 | post = soup.find('div', class_="entry content entry-content type-portfolio") |
|
2722 | imgs = post.find_all('img') |
|
2723 | return { |
|
2724 | 'title': title, |
|
2725 | 'description': desc, |
|
2726 | 'url2': short_url, |
|
2727 | 'img': [i['src'] for i in imgs], |
|
2728 | 'month': day.month, |
|
2729 | 'year': day.year, |
|
2730 | 'day': day.day, |
|
2731 | } |
|
2732 | ||
2733 | ||
@@ 467-495 (lines=29) @@ | ||
464 | first_url = "http://uneanneeaulycee.blog.lemonde.fr/2016/06/13/la-semaine-du-bac-est-arrivee/" |
|
465 | ||
466 | ||
467 | class Rall(GenericNavigableComic): |
|
468 | """Class to retrieve Ted Rall comics.""" |
|
469 | # Also on http://www.gocomics.com/tedrall |
|
470 | name = 'rall' |
|
471 | long_name = "Ted Rall" |
|
472 | url = "http://rall.com/comic" |
|
473 | get_navi_link = get_link_rel_next |
|
474 | get_first_comic_link = simulate_first_link |
|
475 | # Not the first but I didn't find an efficient way to retrieve it |
|
476 | first_url = "http://rall.com/2014/01/30/los-angeles-times-cartoon-well-miss-those-california-flowers" |
|
477 | ||
478 | @classmethod |
|
479 | def get_comic_info(cls, soup, link): |
|
480 | """Get information about a particular comics.""" |
|
481 | title = soup.find('meta', property='og:title')['content'] |
|
482 | author = soup.find("span", class_="author vcard").find("a").string |
|
483 | date_str = soup.find("span", class_="entry-date").string |
|
484 | day = string_to_date(date_str, "%B %d, %Y") |
|
485 | desc = soup.find('meta', property='og:description')['content'] |
|
486 | imgs = soup.find('div', class_='entry-content').find_all('img') |
|
487 | imgs = imgs[:-7] # remove social media buttons |
|
488 | return { |
|
489 | 'title': title, |
|
490 | 'author': author, |
|
491 | 'month': day.month, |
|
492 | 'year': day.year, |
|
493 | 'day': day.day, |
|
494 | 'description': desc, |
|
495 | 'img': [i['src'] for i in imgs], |
|
496 | } |
|
497 | ||
498 |