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