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