|
@@ 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 |
|
|
|
@@ 452-480 (lines=29) @@
|
| 449 |
|
first_url = "http://uneanneeaulycee.blog.lemonde.fr/2016/06/13/la-semaine-du-bac-est-arrivee/" |
| 450 |
|
|
| 451 |
|
|
| 452 |
|
class Rall(GenericNavigableComic): |
| 453 |
|
"""Class to retrieve Ted Rall comics.""" |
| 454 |
|
# Also on http://www.gocomics.com/tedrall |
| 455 |
|
name = 'rall' |
| 456 |
|
long_name = "Ted Rall" |
| 457 |
|
url = "http://rall.com/comic" |
| 458 |
|
get_navi_link = get_link_rel_next |
| 459 |
|
get_first_comic_link = simulate_first_link |
| 460 |
|
# Not the first but I didn't find an efficient way to retrieve it |
| 461 |
|
first_url = "http://rall.com/2014/01/30/los-angeles-times-cartoon-well-miss-those-california-flowers" |
| 462 |
|
|
| 463 |
|
@classmethod |
| 464 |
|
def get_comic_info(cls, soup, link): |
| 465 |
|
"""Get information about a particular comics.""" |
| 466 |
|
title = soup.find('meta', property='og:title')['content'] |
| 467 |
|
author = soup.find("span", class_="author vcard").find("a").string |
| 468 |
|
date_str = soup.find("span", class_="entry-date").string |
| 469 |
|
day = string_to_date(date_str, "%B %d, %Y") |
| 470 |
|
desc = soup.find('meta', property='og:description')['content'] |
| 471 |
|
imgs = soup.find('div', class_='entry-content').find_all('img') |
| 472 |
|
imgs = imgs[:-7] # remove social media buttons |
| 473 |
|
return { |
| 474 |
|
'title': title, |
| 475 |
|
'author': author, |
| 476 |
|
'month': day.month, |
| 477 |
|
'year': day.year, |
| 478 |
|
'day': day.day, |
| 479 |
|
'description': desc, |
| 480 |
|
'img': [i['src'] for i in imgs], |
| 481 |
|
} |
| 482 |
|
|
| 483 |
|
|