@@ 2863-2893 (lines=31) @@ | ||
2860 | lang = "fr_FR.utf8" |
|
2861 | ||
2862 | ||
2863 | class UnearthedComics(GenericNavigableComic): |
|
2864 | """Class to retrieve Unearthed comics.""" |
|
2865 | # Also on http://tapastic.com/series/UnearthedComics |
|
2866 | # Also on https://unearthedcomics.tumblr.com |
|
2867 | name = 'unearthed' |
|
2868 | long_name = 'Unearthed Comics' |
|
2869 | url = 'http://unearthedcomics.com' |
|
2870 | _categories = ('UNEARTHED', ) |
|
2871 | get_navi_link = get_link_rel_next |
|
2872 | get_first_comic_link = simulate_first_link |
|
2873 | first_url = 'http://unearthedcomics.com/comics/world-with-turn-signals/' |
|
2874 | ||
2875 | @classmethod |
|
2876 | def get_comic_info(cls, soup, link): |
|
2877 | """Get information about a particular comics.""" |
|
2878 | short_url = soup.find('link', rel='shortlink')['href'] |
|
2879 | title_elt = soup.find('h1') or soup.find('h2') |
|
2880 | title = title_elt.string if title_elt else "" |
|
2881 | desc = soup.find('meta', property='og:description') |
|
2882 | date_str = soup.find('time', class_='published updated hidden')['datetime'] |
|
2883 | day = string_to_date(date_str, "%Y-%m-%d") |
|
2884 | post = soup.find('div', class_="entry content entry-content type-portfolio") |
|
2885 | imgs = post.find_all('img') |
|
2886 | return { |
|
2887 | 'title': title, |
|
2888 | 'description': desc, |
|
2889 | 'url2': short_url, |
|
2890 | 'img': [i['src'] for i in imgs], |
|
2891 | 'month': day.month, |
|
2892 | 'year': day.year, |
|
2893 | 'day': day.day, |
|
2894 | } |
|
2895 | ||
2896 | ||
@@ 478-507 (lines=30) @@ | ||
475 | first_url = "http://uneanneeaulycee.blog.lemonde.fr/2016/06/13/la-semaine-du-bac-est-arrivee/" |
|
476 | ||
477 | ||
478 | class Rall(GenericNavigableComic): |
|
479 | """Class to retrieve Ted Rall comics.""" |
|
480 | # Also on http://www.gocomics.com/tedrall |
|
481 | name = 'rall' |
|
482 | long_name = "Ted Rall" |
|
483 | url = "http://rall.com/comic" |
|
484 | _categories = ('RALL', ) |
|
485 | get_navi_link = get_link_rel_next |
|
486 | get_first_comic_link = simulate_first_link |
|
487 | # Not the first but I didn't find an efficient way to retrieve it |
|
488 | first_url = "http://rall.com/2014/01/30/los-angeles-times-cartoon-well-miss-those-california-flowers" |
|
489 | ||
490 | @classmethod |
|
491 | def get_comic_info(cls, soup, link): |
|
492 | """Get information about a particular comics.""" |
|
493 | title = soup.find('meta', property='og:title')['content'] |
|
494 | author = soup.find("span", class_="author vcard").find("a").string |
|
495 | date_str = soup.find("span", class_="entry-date").string |
|
496 | day = string_to_date(date_str, "%B %d, %Y") |
|
497 | desc = soup.find('meta', property='og:description')['content'] |
|
498 | imgs = soup.find('div', class_='entry-content').find_all('img') |
|
499 | imgs = imgs[:-7] # remove social media buttons |
|
500 | return { |
|
501 | 'title': title, |
|
502 | 'author': author, |
|
503 | 'month': day.month, |
|
504 | 'year': day.year, |
|
505 | 'day': day.day, |
|
506 | 'description': desc, |
|
507 | 'img': [i['src'] for i in imgs], |
|
508 | } |
|
509 | ||
510 |