@@ 2397-2416 (lines=20) @@ | ||
2394 | 'year': day.year, |
|
2395 | 'day': day.day, |
|
2396 | } |
|
2397 | ||
2398 | ||
2399 | class ThorsThundershack(GenericNavigableComic): |
|
2400 | """Class to retrieve Thor's Thundershack comics.""" |
|
2401 | # Also on http://tapastic.com/series/Thors-Thundershac |
|
2402 | name = 'thor' |
|
2403 | long_name = 'Thor\'s Thundershack' |
|
2404 | url = 'http://www.thorsthundershack.com' |
|
2405 | _categories = ('THOR', ) |
|
2406 | get_url_from_link = join_cls_url_to_href |
|
2407 | ||
2408 | @classmethod |
|
2409 | def get_first_comic_link(cls): |
|
2410 | """Get link to first comics.""" |
|
2411 | return get_soup_at_url(cls.url).find('a', class_='first navlink') |
|
2412 | ||
2413 | @classmethod |
|
2414 | def get_navi_link(cls, last_soup, next_): |
|
2415 | """Get link to next or previous comic.""" |
|
2416 | for link in last_soup.find_all('a', rel='next' if next_ else 'prev'): |
|
2417 | if link['href'] != '/comic': |
|
2418 | return link |
|
2419 | return None |
|
@@ 2596-2614 (lines=19) @@ | ||
2593 | title = soup.find('h2', class_='post-title').string |
|
2594 | author = soup.find("span", class_="post-author").find("a").string |
|
2595 | date_str = soup.find("span", class_="post-date").string |
|
2596 | day = string_to_date(date_str, "%B %d, %Y") |
|
2597 | imgs = soup.find("div", id="comic").find_all("img") |
|
2598 | assert all(i['alt'] == i['title'] for i in imgs) |
|
2599 | assert len(imgs) <= 1 |
|
2600 | alt = imgs[0]['alt'] if imgs else "" |
|
2601 | return { |
|
2602 | 'img': [i['src'] for i in imgs], |
|
2603 | 'title': title, |
|
2604 | 'alt': alt, |
|
2605 | 'author': author, |
|
2606 | 'day': day.day, |
|
2607 | 'month': day.month, |
|
2608 | 'year': day.year |
|
2609 | } |
|
2610 | ||
2611 | ||
2612 | class LastPlaceComics(GenericNavigableComic): |
|
2613 | """Class to retrieve Last Place Comics.""" |
|
2614 | name = 'lastplace' |
|
2615 | long_name = 'Last Place Comics' |
|
2616 | url = "http://lastplacecomics.com" |
|
2617 | get_first_comic_link = get_a_comicnavbase_comicnavfirst |
|
@@ 2485-2503 (lines=19) @@ | ||
2482 | def get_comic_info(cls, soup, link): |
|
2483 | """Get information about a particular comics.""" |
|
2484 | title = soup.find("h2", class_="post-title").string |
|
2485 | author = soup.find("span", class_="post-author").find("a").string |
|
2486 | date_str = soup.find("span", class_="post-date").string |
|
2487 | day = string_to_date(date_str, "%d. %B %Y", "de_DE.utf8") |
|
2488 | imgs = soup.find("div", id="comic").find_all("img") |
|
2489 | assert all(i['alt'] == i['title'] == title for i in imgs) |
|
2490 | assert len(imgs) <= 1 |
|
2491 | return { |
|
2492 | 'img': [i['src'] for i in imgs], |
|
2493 | 'title': title, |
|
2494 | 'author': author, |
|
2495 | 'day': day.day, |
|
2496 | 'month': day.month, |
|
2497 | 'year': day.year |
|
2498 | } |
|
2499 | ||
2500 | ||
2501 | class BiterComics(GenericNavigableComic): |
|
2502 | """Class to retrieve Biter Comics.""" |
|
2503 | name = "biter" |
|
2504 | long_name = "Biter Comics" |
|
2505 | url = "http://www.bitercomics.com" |
|
2506 | get_first_comic_link = get_a_navi_navifirst |
|
@@ 2011-2029 (lines=19) @@ | ||
2008 | get_first_comic_link = get_a_navi_navifirst |
|
2009 | get_navi_link = get_a_navi_navinext |
|
2010 | ||
2011 | @classmethod |
|
2012 | def get_comic_info(cls, soup, link): |
|
2013 | """Get information about a particular comics.""" |
|
2014 | title = soup.find('h2', class_='post-title').string |
|
2015 | author = soup.find('span', class_='post-author').contents[1].string |
|
2016 | date_str = soup.find('span', class_='post-date').string |
|
2017 | day = string_to_date(date_str, '%B %d, %Y') |
|
2018 | imgs = soup.find('div', class_='comicpane').find_all('img') |
|
2019 | assert imgs |
|
2020 | alt = imgs[0]['title'] |
|
2021 | assert all(i['title'] == i['alt'] == alt for i in imgs) |
|
2022 | return { |
|
2023 | 'month': day.month, |
|
2024 | 'year': day.year, |
|
2025 | 'day': day.day, |
|
2026 | 'img': [i['src'] for i in imgs], |
|
2027 | 'title': title, |
|
2028 | 'alt': alt, |
|
2029 | 'author': author, |
|
2030 | } |
|
2031 | ||
2032 | ||
@@ 2629-2646 (lines=18) @@ | ||
2626 | day = string_to_date(date_str, "%B %d, %Y") |
|
2627 | imgs = soup.find("div", id="comic").find_all("img") |
|
2628 | assert all(i['alt'] == i['title'] for i in imgs) |
|
2629 | assert len(imgs) <= 1 |
|
2630 | alt = imgs[0]['alt'] if imgs else "" |
|
2631 | return { |
|
2632 | 'img': [i['src'] for i in imgs], |
|
2633 | 'title': title, |
|
2634 | 'alt': alt, |
|
2635 | 'author': author, |
|
2636 | 'day': day.day, |
|
2637 | 'month': day.month, |
|
2638 | 'year': day.year |
|
2639 | } |
|
2640 | ||
2641 | ||
2642 | class TalesOfAbsurdity(GenericNavigableComic): |
|
2643 | """Class to retrieve Tales Of Absurdity comics.""" |
|
2644 | # Also on http://tapastic.com/series/Tales-Of-Absurdity |
|
2645 | # Also on http://talesofabsurdity.tumblr.com |
|
2646 | name = 'absurdity' |
|
2647 | long_name = 'Tales of Absurdity' |
|
2648 | url = 'http://talesofabsurdity.com' |
|
2649 | _categories = ('ABSURDITY', ) |
|
@@ 2428-2445 (lines=18) @@ | ||
2425 | description = soup.find('div', itemprop='articleBody').text |
|
2426 | author = soup.find('span', itemprop='author copyrightHolder').string |
|
2427 | imgs = soup.find_all('img', itemprop='image') |
|
2428 | assert all(i['title'] == i['alt'] for i in imgs) |
|
2429 | alt = imgs[0]['alt'] if imgs else "" |
|
2430 | date_str = soup.find('time', itemprop='datePublished')["datetime"] |
|
2431 | day = string_to_date(date_str, "%Y-%m-%d %H:%M:%S") |
|
2432 | return { |
|
2433 | 'img': [urljoin_wrapper(cls.url, i['src']) for i in imgs], |
|
2434 | 'month': day.month, |
|
2435 | 'year': day.year, |
|
2436 | 'day': day.day, |
|
2437 | 'author': author, |
|
2438 | 'title': title, |
|
2439 | 'alt': alt, |
|
2440 | 'description': description, |
|
2441 | } |
|
2442 | ||
2443 | ||
2444 | class GerbilWithAJetpack(GenericNavigableComic): |
|
2445 | """Class to retrieve GerbilWithAJetpack comics.""" |
|
2446 | name = 'gerbil' |
|
2447 | long_name = 'Gerbil With A Jetpack' |
|
2448 | url = 'http://gerbilwithajetpack.com' |