|
@@ 913-938 (lines=26) @@
|
| 910 |
|
} |
| 911 |
|
|
| 912 |
|
|
| 913 |
|
class MyExtraLife(GenericNavigableComic): |
| 914 |
|
"""Class to retrieve My Extra Life comics.""" |
| 915 |
|
name = 'extralife' |
| 916 |
|
long_name = 'My Extra Life' |
| 917 |
|
url = 'http://www.myextralife.com' |
| 918 |
|
get_navi_link = get_link_rel_next |
| 919 |
|
|
| 920 |
|
@classmethod |
| 921 |
|
def get_first_comic_link(cls): |
| 922 |
|
"""Get link to first comics.""" |
| 923 |
|
return get_soup_at_url(cls.url).find('a', class_='comic_nav_link first_comic_link') |
| 924 |
|
|
| 925 |
|
@classmethod |
| 926 |
|
def get_comic_info(cls, soup, link): |
| 927 |
|
"""Get information about a particular comics.""" |
| 928 |
|
title = soup.find("h1", class_="comic_title").string |
| 929 |
|
date_str = soup.find("span", class_="comic_date").string |
| 930 |
|
day = string_to_date(date_str, "%B %d, %Y") |
| 931 |
|
imgs = soup.find_all("img", class_="comic") |
| 932 |
|
assert all(i['alt'] == i['title'] == title for i in imgs) |
| 933 |
|
return { |
| 934 |
|
'title': title, |
| 935 |
|
'img': [i['src'] for i in imgs if i["src"]], |
| 936 |
|
'day': day.day, |
| 937 |
|
'month': day.month, |
| 938 |
|
'year': day.year |
| 939 |
|
} |
| 940 |
|
|
| 941 |
|
|
|
@@ 2276-2300 (lines=25) @@
|
| 2273 |
|
} |
| 2274 |
|
|
| 2275 |
|
|
| 2276 |
|
class LinsEditions(GenericNavigableComic): |
| 2277 |
|
"""Class to retrieve L.I.N.S. Editions comics.""" |
| 2278 |
|
# Also on http://linscomics.tumblr.com |
| 2279 |
|
# Now on https://warandpeas.com |
| 2280 |
|
name = 'lins' |
| 2281 |
|
long_name = 'L.I.N.S. Editions' |
| 2282 |
|
url = 'https://linsedition.com' |
| 2283 |
|
_categories = ('LINS', ) |
| 2284 |
|
get_navi_link = get_link_rel_next |
| 2285 |
|
get_first_comic_link = simulate_first_link |
| 2286 |
|
first_url = 'https://linsedition.com/2011/09/07/l-i-n-s/' |
| 2287 |
|
|
| 2288 |
|
@classmethod |
| 2289 |
|
def get_comic_info(cls, soup, link): |
| 2290 |
|
"""Get information about a particular comics.""" |
| 2291 |
|
title = soup.find('meta', property='og:title')['content'] |
| 2292 |
|
imgs = soup.find_all('meta', property='og:image') |
| 2293 |
|
date_str = soup.find('meta', property='article:published_time')['content'][:10] |
| 2294 |
|
day = string_to_date(date_str, "%Y-%m-%d") |
| 2295 |
|
return { |
| 2296 |
|
'title': title, |
| 2297 |
|
'img': [i['content'] for i in imgs], |
| 2298 |
|
'month': day.month, |
| 2299 |
|
'year': day.year, |
| 2300 |
|
'day': day.day, |
| 2301 |
|
} |
| 2302 |
|
|
| 2303 |
|
|
|
@@ 343-365 (lines=23) @@
|
| 340 |
|
return [] |
| 341 |
|
|
| 342 |
|
|
| 343 |
|
class ExtraFabulousComics(GenericNavigableComic): |
| 344 |
|
"""Class to retrieve Extra Fabulous Comics.""" |
| 345 |
|
name = 'efc' |
| 346 |
|
long_name = 'Extra Fabulous Comics' |
| 347 |
|
url = 'http://extrafabulouscomics.com' |
| 348 |
|
get_first_comic_link = get_a_navi_navifirst |
| 349 |
|
get_navi_link = get_link_rel_next |
| 350 |
|
|
| 351 |
|
@classmethod |
| 352 |
|
def get_comic_info(cls, soup, link): |
| 353 |
|
"""Get information about a particular comics.""" |
| 354 |
|
img_src_re = re.compile('^%s/wp-content/uploads/' % cls.url) |
| 355 |
|
imgs = soup.find_all('img', src=img_src_re) |
| 356 |
|
title = soup.find('meta', property='og:title')['content'] |
| 357 |
|
date_str = soup.find('meta', property='article:published_time')['content'][:10] |
| 358 |
|
day = string_to_date(date_str, "%Y-%m-%d") |
| 359 |
|
return { |
| 360 |
|
'title': title, |
| 361 |
|
'img': [i['src'] for i in imgs], |
| 362 |
|
'month': day.month, |
| 363 |
|
'year': day.year, |
| 364 |
|
'day': day.day, |
| 365 |
|
'prefix': title + '-' |
| 366 |
|
} |
| 367 |
|
|
| 368 |
|
|
|
@@ 369-390 (lines=22) @@
|
| 366 |
|
} |
| 367 |
|
|
| 368 |
|
|
| 369 |
|
class GenericLeMondeBlog(GenericNavigableComic): |
| 370 |
|
"""Generic class to retrieve comics from Le Monde blogs.""" |
| 371 |
|
_categories = ('LEMONDE', 'FRANCAIS') |
| 372 |
|
get_navi_link = get_link_rel_next |
| 373 |
|
get_first_comic_link = simulate_first_link |
| 374 |
|
first_url = NotImplemented |
| 375 |
|
|
| 376 |
|
@classmethod |
| 377 |
|
def get_comic_info(cls, soup, link): |
| 378 |
|
"""Get information about a particular comics.""" |
| 379 |
|
url2 = soup.find('link', rel='shortlink')['href'] |
| 380 |
|
title = soup.find('meta', property='og:title')['content'] |
| 381 |
|
date_str = soup.find("span", class_="entry-date").string |
| 382 |
|
day = string_to_date(date_str, "%d %B %Y", "fr_FR.utf8") |
| 383 |
|
imgs = soup.find_all('meta', property='og:image') |
| 384 |
|
return { |
| 385 |
|
'title': title, |
| 386 |
|
'url2': url2, |
| 387 |
|
'img': [convert_iri_to_plain_ascii_uri(i['content']) for i in imgs], |
| 388 |
|
'month': day.month, |
| 389 |
|
'year': day.year, |
| 390 |
|
'day': day.day, |
| 391 |
|
} |
| 392 |
|
|
| 393 |
|
|