@@ 909-934 (lines=26) @@ | ||
906 | } |
|
907 | ||
908 | ||
909 | class MyExtraLife(GenericNavigableComic): |
|
910 | """Class to retrieve My Extra Life comics.""" |
|
911 | name = 'extralife' |
|
912 | long_name = 'My Extra Life' |
|
913 | url = 'http://www.myextralife.com' |
|
914 | get_navi_link = get_link_rel_next |
|
915 | ||
916 | @classmethod |
|
917 | def get_first_comic_link(cls): |
|
918 | """Get link to first comics.""" |
|
919 | return get_soup_at_url(cls.url).find('a', class_='comic_nav_link first_comic_link') |
|
920 | ||
921 | @classmethod |
|
922 | def get_comic_info(cls, soup, link): |
|
923 | """Get information about a particular comics.""" |
|
924 | title = soup.find("h1", class_="comic_title").string |
|
925 | date_str = soup.find("span", class_="comic_date").string |
|
926 | day = string_to_date(date_str, "%B %d, %Y") |
|
927 | imgs = soup.find_all("img", class_="comic") |
|
928 | assert all(i['alt'] == i['title'] == title for i in imgs) |
|
929 | return { |
|
930 | 'title': title, |
|
931 | 'img': [i['src'] for i in imgs if i["src"]], |
|
932 | 'day': day.day, |
|
933 | 'month': day.month, |
|
934 | 'year': day.year |
|
935 | } |
|
936 | ||
937 | ||
@@ 2248-2270 (lines=23) @@ | ||
2245 | } |
|
2246 | ||
2247 | ||
2248 | class LinsEditions(GenericNavigableComic): |
|
2249 | """Class to retrieve L.I.N.S. Editions comics.""" |
|
2250 | # Also on http://linscomics.tumblr.com |
|
2251 | name = 'lins' |
|
2252 | long_name = 'L.I.N.S. Editions' |
|
2253 | url = 'https://linsedition.com' |
|
2254 | get_navi_link = get_link_rel_next |
|
2255 | get_first_comic_link = simulate_first_link |
|
2256 | first_url = 'https://linsedition.com/2011/09/07/l-i-n-s/' |
|
2257 | ||
2258 | @classmethod |
|
2259 | def get_comic_info(cls, soup, link): |
|
2260 | """Get information about a particular comics.""" |
|
2261 | title = soup.find('meta', property='og:title')['content'] |
|
2262 | imgs = soup.find_all('meta', property='og:image') |
|
2263 | date_str = soup.find('meta', property='article:published_time')['content'][:10] |
|
2264 | day = string_to_date(date_str, "%Y-%m-%d") |
|
2265 | return { |
|
2266 | 'title': title, |
|
2267 | 'img': [i['content'] for i in imgs], |
|
2268 | 'month': day.month, |
|
2269 | 'year': day.year, |
|
2270 | 'day': day.day, |
|
2271 | } |
|
2272 | ||
2273 | ||
@@ 378-398 (lines=21) @@ | ||
375 | } |
|
376 | ||
377 | ||
378 | class GenericLeMondeBlog(GenericNavigableComic): |
|
379 | """Generic class to retrieve comics from Le Monde blogs.""" |
|
380 | get_navi_link = get_link_rel_next |
|
381 | get_first_comic_link = simulate_first_link |
|
382 | first_url = NotImplemented |
|
383 | ||
384 | @classmethod |
|
385 | def get_comic_info(cls, soup, link): |
|
386 | """Get information about a particular comics.""" |
|
387 | url2 = soup.find('link', rel='shortlink')['href'] |
|
388 | title = soup.find('meta', property='og:title')['content'] |
|
389 | date_str = soup.find("span", class_="entry-date").string |
|
390 | day = string_to_date(date_str, "%d %B %Y", "fr_FR.utf8") |
|
391 | imgs = soup.find_all('meta', property='og:image') |
|
392 | return { |
|
393 | 'title': title, |
|
394 | 'url2': url2, |
|
395 | 'img': [convert_iri_to_plain_ascii_uri(i['content']) for i in imgs], |
|
396 | 'month': day.month, |
|
397 | 'year': day.year, |
|
398 | 'day': day.day, |
|
399 | } |
|
400 | ||
401 | ||
@@ 2404-2428 (lines=25) @@ | ||
2401 | } |
|
2402 | ||
2403 | ||
2404 | class TheAwkwardYeti(GenericNavigableComic): |
|
2405 | """Class to retrieve The Awkward Yeti comics.""" |
|
2406 | # Also on http://www.gocomics.com/the-awkward-yeti |
|
2407 | # Also on http://larstheyeti.tumblr.com |
|
2408 | # Also on https://tapastic.com/series/TheAwkwardYeti |
|
2409 | name = 'yeti' |
|
2410 | long_name = 'The Awkward Yeti' |
|
2411 | url = 'http://theawkwardyeti.com' |
|
2412 | get_first_comic_link = get_a_navi_navifirst |
|
2413 | get_navi_link = get_link_rel_next |
|
2414 | ||
2415 | @classmethod |
|
2416 | def get_comic_info(cls, soup, link): |
|
2417 | """Get information about a particular comics.""" |
|
2418 | title = soup.find('h2', class_='post-title').string |
|
2419 | date_str = soup.find("span", class_="post-date").string |
|
2420 | day = string_to_date(date_str, "%B %d, %Y") |
|
2421 | imgs = soup.find("div", id="comic").find_all("img") |
|
2422 | assert all(idx > 0 or i['alt'] == i['title'] for idx, i in enumerate(imgs)) |
|
2423 | return { |
|
2424 | 'img': [i['src'] for i in imgs], |
|
2425 | 'title': title, |
|
2426 | 'day': day.day, |
|
2427 | 'month': day.month, |
|
2428 | 'year': day.year |
|
2429 | } |
|
2430 | ||
2431 |