@@ 720-743 (lines=24) @@ | ||
717 | } |
|
718 | ||
719 | ||
720 | class OneOneOneOneComic(GenericComicNotWorking, GenericNavigableComic): |
|
721 | """Class to retrieve 1111 Comics.""" |
|
722 | # Also on http://comics1111.tumblr.com |
|
723 | # Also on https://tapastic.com/series/1111-Comics |
|
724 | name = '1111' |
|
725 | long_name = '1111 Comics' |
|
726 | url = 'http://www.1111comics.me' |
|
727 | _categories = ('ONEONEONEONE', ) |
|
728 | get_first_comic_link = get_div_navfirst_a |
|
729 | get_navi_link = get_link_rel_next |
|
730 | ||
731 | @classmethod |
|
732 | def get_comic_info(cls, soup, link): |
|
733 | """Get information about a particular comics.""" |
|
734 | title = soup.find('h1', class_='comic-title').find('a').string |
|
735 | date_str = soup.find('header', class_='comic-meta entry-meta').find('a').string |
|
736 | day = string_to_date(date_str, "%B %d, %Y") |
|
737 | imgs = soup.find_all('meta', property='og:image') |
|
738 | return { |
|
739 | 'title': title, |
|
740 | 'month': day.month, |
|
741 | 'year': day.year, |
|
742 | 'day': day.day, |
|
743 | 'img': [i['content'] for i in imgs], |
|
744 | } |
|
745 | ||
746 | ||
@@ 948-970 (lines=23) @@ | ||
945 | } |
|
946 | ||
947 | ||
948 | class TheGentlemanArmchair(GenericNavigableComic): |
|
949 | """Class to retrieve The Gentleman Armchair comics.""" |
|
950 | name = 'gentlemanarmchair' |
|
951 | long_name = 'The Gentleman Armchair' |
|
952 | url = 'http://thegentlemansarmchair.com' |
|
953 | get_first_comic_link = get_a_navi_navifirst |
|
954 | get_navi_link = get_link_rel_next |
|
955 | ||
956 | @classmethod |
|
957 | def get_comic_info(cls, soup, link): |
|
958 | """Get information about a particular comics.""" |
|
959 | title = soup.find('h2', class_='post-title').string |
|
960 | author = soup.find("span", class_="post-author").find("a").string |
|
961 | date_str = soup.find('span', class_='post-date').string |
|
962 | day = string_to_date(date_str, "%B %d, %Y") |
|
963 | imgs = soup.find('div', id='comic').find_all('img') |
|
964 | return { |
|
965 | 'img': [i['src'] for i in imgs], |
|
966 | 'title': title, |
|
967 | 'author': author, |
|
968 | 'month': day.month, |
|
969 | 'year': day.year, |
|
970 | 'day': day.day, |
|
971 | } |
|
972 | ||
973 | ||
@@ 747-768 (lines=22) @@ | ||
744 | } |
|
745 | ||
746 | ||
747 | class AngryAtNothing(GenericDeletedComic, GenericNavigableComic): |
|
748 | """Class to retrieve Angry at Nothing comics.""" |
|
749 | # Also on http://tapastic.com/series/Comics-yeah-definitely-comics- |
|
750 | # Also on http://angryatnothing.tumblr.com |
|
751 | name = 'angry' |
|
752 | long_name = 'Angry At Nothing' |
|
753 | url = 'http://www.angryatnothing.net' |
|
754 | get_first_comic_link = get_div_navfirst_a |
|
755 | get_navi_link = get_a_rel_next |
|
756 | ||
757 | @classmethod |
|
758 | def get_comic_info(cls, soup, link): |
|
759 | """Get information about a particular comics.""" |
|
760 | title = soup.find('h1', class_='comic-title').find('a').string |
|
761 | date_str = soup.find('header', class_='comic-meta entry-meta').find('a').string |
|
762 | day = string_to_date(date_str, "%B %d, %Y") |
|
763 | imgs = soup.find_all('meta', property='og:image') |
|
764 | return { |
|
765 | 'title': title, |
|
766 | 'month': day.month, |
|
767 | 'year': day.year, |
|
768 | 'day': day.day, |
|
769 | 'img': [i['content'] for i in imgs], |
|
770 | } |
|
771 | ||
@@ 694-716 (lines=23) @@ | ||
691 | } |
|
692 | ||
693 | ||
694 | class PenelopeBagieu(GenericNavigableComic): |
|
695 | """Class to retrieve comics from Penelope Bagieu's blog.""" |
|
696 | name = 'bagieu' |
|
697 | long_name = 'Ma vie est tout a fait fascinante (Bagieu)' |
|
698 | url = 'http://www.penelope-jolicoeur.com' |
|
699 | _categories = ('FRANCAIS', ) |
|
700 | get_navi_link = get_link_rel_next |
|
701 | get_first_comic_link = simulate_first_link |
|
702 | first_url = 'http://www.penelope-jolicoeur.com/2007/02/ma-vie-mon-oeuv.html' |
|
703 | ||
704 | @classmethod |
|
705 | def get_comic_info(cls, soup, link): |
|
706 | """Get information about a particular comics.""" |
|
707 | date_str = soup.find('h2', class_='date-header').string |
|
708 | day = string_to_date(date_str, "%A %d %B %Y", "fr_FR.utf8") |
|
709 | imgs = soup.find('div', class_='entry-body').find_all('img') |
|
710 | title = soup.find('h3', class_='entry-header').string |
|
711 | return { |
|
712 | 'title': title, |
|
713 | 'img': [i['src'] for i in imgs], |
|
714 | 'month': day.month, |
|
715 | 'year': day.year, |
|
716 | 'day': day.day, |
|
717 | } |
|
718 | ||
719 | ||
@@ 1908-1934 (lines=27) @@ | ||
1905 | class PicturesInBoxes(GenericNavigableComic): |
|
1906 | """Class to retrieve Pictures In Boxes comics.""" |
|
1907 | # Also on https://picturesinboxescomic.tumblr.com |
|
1908 | name = 'picturesinboxes' |
|
1909 | long_name = 'Pictures in Boxes' |
|
1910 | url = 'http://www.picturesinboxes.com' |
|
1911 | get_navi_link = get_a_navi_navinext |
|
1912 | get_first_comic_link = simulate_first_link |
|
1913 | first_url = 'http://www.picturesinboxes.com/2013/10/26/tetris/' |
|
1914 | ||
1915 | @classmethod |
|
1916 | def get_comic_info(cls, soup, link): |
|
1917 | """Get information about a particular comics.""" |
|
1918 | title = soup.find('h2', class_='post-title').string |
|
1919 | author = soup.find("span", class_="post-author").find("a").string |
|
1920 | date_str = soup.find('span', class_='post-date').string |
|
1921 | day = string_to_date(date_str, '%B %d, %Y') |
|
1922 | imgs = soup.find('div', class_='comicpane').find_all('img') |
|
1923 | assert imgs |
|
1924 | assert all(i['title'] == i['alt'] == title for i in imgs) |
|
1925 | return { |
|
1926 | 'day': day.day, |
|
1927 | 'month': day.month, |
|
1928 | 'year': day.year, |
|
1929 | 'img': [i['src'] for i in imgs], |
|
1930 | 'title': title, |
|
1931 | 'author': author, |
|
1932 | } |
|
1933 | ||
1934 | ||
1935 | class Penmen(GenericComicNotWorking, GenericNavigableComic): |
|
1936 | """Class to retrieve Penmen comics.""" |
|
1937 | name = 'penmen' |
|
@@ 2895-2919 (lines=25) @@ | ||
2892 | title = soup.find('meta', property='og:title')['content'] |
|
2893 | imgs = soup.find('div', class_='entry-content').find_all('img') |
|
2894 | title2 = ' '.join(i.get('title', '') for i in imgs) |
|
2895 | return { |
|
2896 | 'title': title, |
|
2897 | 'title2': title2, |
|
2898 | 'description': desc, |
|
2899 | 'img': [urljoin_wrapper(cls.url, convert_iri_to_plain_ascii_uri(i['src'])) for i in imgs], |
|
2900 | } |
|
2901 | ||
2902 | ||
2903 | class CommitStripFr(GenericCommitStrip): |
|
2904 | """Class to retrieve Commit Strips in French.""" |
|
2905 | name = 'commit_fr' |
|
2906 | long_name = 'Commit Strip (Fr)' |
|
2907 | url = 'http://www.commitstrip.com/fr' |
|
2908 | _categories = ('FRANCAIS', ) |
|
2909 | first_url = 'http://www.commitstrip.com/fr/2012/02/22/interview/' |
|
2910 | ||
2911 | ||
2912 | class CommitStripEn(GenericCommitStrip): |
|
2913 | """Class to retrieve Commit Strips in English.""" |
|
2914 | name = 'commit_en' |
|
2915 | long_name = 'Commit Strip (En)' |
|
2916 | url = 'http://www.commitstrip.com/en' |
|
2917 | first_url = 'http://www.commitstrip.com/en/2012/02/22/interview/' |
|
2918 | ||
2919 | ||
2920 | class GenericBoumerie(GenericNavigableComic): |
|
2921 | """Generic class to retrieve Boumeries comics in different languages.""" |
|
2922 | # Also on http://boumeries.tumblr.com |
|
@@ 2641-2666 (lines=26) @@ | ||
2638 | name = "biter" |
|
2639 | long_name = "Biter Comics" |
|
2640 | url = "http://www.bitercomics.com" |
|
2641 | get_first_comic_link = get_a_navi_navifirst |
|
2642 | get_navi_link = get_link_rel_next |
|
2643 | ||
2644 | @classmethod |
|
2645 | def get_comic_info(cls, soup, link): |
|
2646 | """Get information about a particular comics.""" |
|
2647 | title = soup.find("h1", class_="entry-title").string |
|
2648 | author = soup.find("span", class_="author vcard").find("a").string |
|
2649 | date_str = soup.find("span", class_="entry-date").string |
|
2650 | day = string_to_date(date_str, "%B %d, %Y") |
|
2651 | imgs = soup.find("div", id="comic").find_all("img") |
|
2652 | assert all(i['alt'] == i['title'] for i in imgs) |
|
2653 | assert len(imgs) == 1, imgs |
|
2654 | alt = imgs[0]['alt'] |
|
2655 | return { |
|
2656 | 'img': [i['src'] for i in imgs], |
|
2657 | 'title': title, |
|
2658 | 'alt': alt, |
|
2659 | 'author': author, |
|
2660 | 'day': day.day, |
|
2661 | 'month': day.month, |
|
2662 | 'year': day.year |
|
2663 | } |
|
2664 | ||
2665 | ||
2666 | class TheAwkwardYeti(GenericNavigableComic): |
|
2667 | """Class to retrieve The Awkward Yeti comics.""" |
|
2668 | # Also on http://www.gocomics.com/the-awkward-yeti |
|
2669 | # Also on http://larstheyeti.tumblr.com |
|
@@ 2554-2579 (lines=26) @@ | ||
2551 | for link in last_soup.find_all('a', rel='next' if next_ else 'prev'): |
|
2552 | if link['href'] != '/comic': |
|
2553 | return link |
|
2554 | return None |
|
2555 | ||
2556 | @classmethod |
|
2557 | def get_comic_info(cls, soup, link): |
|
2558 | """Get information about a particular comics.""" |
|
2559 | title = soup.find('meta', attrs={'name': 'description'})["content"] |
|
2560 | description = soup.find('div', itemprop='articleBody').text |
|
2561 | author = soup.find('span', itemprop='author copyrightHolder').string |
|
2562 | imgs = soup.find_all('img', itemprop='image') |
|
2563 | assert all(i['title'] == i['alt'] for i in imgs) |
|
2564 | alt = imgs[0]['alt'] if imgs else "" |
|
2565 | date_str = soup.find('time', itemprop='datePublished')["datetime"] |
|
2566 | day = string_to_date(date_str, "%Y-%m-%d %H:%M:%S") |
|
2567 | return { |
|
2568 | 'img': [urljoin_wrapper(cls.url, i['src']) for i in imgs], |
|
2569 | 'month': day.month, |
|
2570 | 'year': day.year, |
|
2571 | 'day': day.day, |
|
2572 | 'author': author, |
|
2573 | 'title': title, |
|
2574 | 'alt': alt, |
|
2575 | 'description': description, |
|
2576 | } |
|
2577 | ||
2578 | ||
2579 | class GerbilWithAJetpack(GenericNavigableComic): |
|
2580 | """Class to retrieve GerbilWithAJetpack comics.""" |
|
2581 | name = 'gerbil' |
|
2582 | long_name = 'Gerbil With A Jetpack' |
|
@@ 2583-2607 (lines=25) @@ | ||
2580 | """Class to retrieve GerbilWithAJetpack comics.""" |
|
2581 | name = 'gerbil' |
|
2582 | long_name = 'Gerbil With A Jetpack' |
|
2583 | url = 'http://gerbilwithajetpack.com' |
|
2584 | get_first_comic_link = get_a_navi_navifirst |
|
2585 | get_navi_link = get_a_rel_next |
|
2586 | ||
2587 | @classmethod |
|
2588 | def get_comic_info(cls, soup, link): |
|
2589 | """Get information about a particular comics.""" |
|
2590 | title = soup.find('h2', class_='post-title').string |
|
2591 | author = soup.find("span", class_="post-author").find("a").string |
|
2592 | date_str = soup.find("span", class_="post-date").string |
|
2593 | day = string_to_date(date_str, "%B %d, %Y") |
|
2594 | imgs = soup.find("div", id="comic").find_all("img") |
|
2595 | alt = imgs[0]['alt'] |
|
2596 | assert all(i['alt'] == i['title'] == alt for i in imgs) |
|
2597 | return { |
|
2598 | 'img': [i['src'] for i in imgs], |
|
2599 | 'title': title, |
|
2600 | 'alt': alt, |
|
2601 | 'author': author, |
|
2602 | 'day': day.day, |
|
2603 | 'month': day.month, |
|
2604 | 'year': day.year |
|
2605 | } |
|
2606 | ||
2607 | ||
2608 | class EveryDayBlues(GenericDeletedComic, GenericNavigableComic): |
|
2609 | """Class to retrieve EveryDayBlues Comics.""" |
|
2610 | name = "blues" |
|
@@ 1796-1820 (lines=25) @@ | ||
1793 | class MouseBearComedy(GenericComicNotWorking): # Website has changed |
|
1794 | """Class to retrieve Mouse Bear Comedy comics.""" |
|
1795 | # Also on http://mousebearcomedy.tumblr.com |
|
1796 | name = 'mousebear' |
|
1797 | long_name = 'Mouse Bear Comedy' |
|
1798 | url = 'http://www.mousebearcomedy.com' |
|
1799 | get_first_comic_link = get_a_navi_navifirst |
|
1800 | get_navi_link = get_a_navi_comicnavnext_navinext |
|
1801 | ||
1802 | @classmethod |
|
1803 | def get_comic_info(cls, soup, link): |
|
1804 | """Get information about a particular comics.""" |
|
1805 | title = soup.find('h2', class_='post-title').string |
|
1806 | author = soup.find("span", class_="post-author").find("a").string |
|
1807 | date_str = soup.find("span", class_="post-date").string |
|
1808 | day = string_to_date(date_str, '%B %d, %Y') |
|
1809 | imgs = soup.find("div", id="comic").find_all("img") |
|
1810 | assert all(i['alt'] == i['title'] == title for i in imgs) |
|
1811 | return { |
|
1812 | 'day': day.day, |
|
1813 | 'month': day.month, |
|
1814 | 'year': day.year, |
|
1815 | 'img': [i['src'] for i in imgs], |
|
1816 | 'title': title, |
|
1817 | 'author': author, |
|
1818 | } |
|
1819 | ||
1820 | ||
1821 | class BigFootJustice(GenericNavigableComic): |
|
1822 | """Class to retrieve Big Foot Justice comics.""" |
|
1823 | # Also on http://tapastic.com/series/bigfoot-justice |
|
@@ 1206-1229 (lines=24) @@ | ||
1203 | url = 'http://english.bouletcorp.com' |
|
1204 | ||
1205 | ||
1206 | class AmazingSuperPowers(GenericNavigableComic): |
|
1207 | """Class to retrieve Amazing Super Powers comics.""" |
|
1208 | name = 'asp' |
|
1209 | long_name = 'Amazing Super Powers' |
|
1210 | url = 'http://www.amazingsuperpowers.com' |
|
1211 | get_first_comic_link = get_a_navi_navifirst |
|
1212 | get_navi_link = get_a_navi_navinext |
|
1213 | ||
1214 | @classmethod |
|
1215 | def get_comic_info(cls, soup, link): |
|
1216 | """Get information about a particular comics.""" |
|
1217 | author = soup.find("span", class_="post-author").find("a").string |
|
1218 | date_str = soup.find('span', class_='post-date').string |
|
1219 | day = string_to_date(date_str, "%B %d, %Y") |
|
1220 | imgs = soup.find('div', id='comic').find_all('img') |
|
1221 | title = ' '.join(i['title'] for i in imgs) |
|
1222 | assert all(i['alt'] == i['title'] for i in imgs) |
|
1223 | return { |
|
1224 | 'title': title, |
|
1225 | 'author': author, |
|
1226 | 'img': [img['src'] for img in imgs], |
|
1227 | 'day': day.day, |
|
1228 | 'month': day.month, |
|
1229 | 'year': day.year |
|
1230 | } |
|
1231 | ||
1232 | ||
@@ 2611-2637 (lines=27) @@ | ||
2608 | class EveryDayBlues(GenericDeletedComic, GenericNavigableComic): |
|
2609 | """Class to retrieve EveryDayBlues Comics.""" |
|
2610 | name = "blues" |
|
2611 | long_name = "Every Day Blues" |
|
2612 | url = "http://everydayblues.net" |
|
2613 | get_first_comic_link = get_a_navi_navifirst |
|
2614 | get_navi_link = get_link_rel_next |
|
2615 | ||
2616 | @classmethod |
|
2617 | def get_comic_info(cls, soup, link): |
|
2618 | """Get information about a particular comics.""" |
|
2619 | title = soup.find("h2", class_="post-title").string |
|
2620 | author = soup.find("span", class_="post-author").find("a").string |
|
2621 | date_str = soup.find("span", class_="post-date").string |
|
2622 | day = string_to_date(date_str, "%d. %B %Y", "de_DE.utf8") |
|
2623 | imgs = soup.find("div", id="comic").find_all("img") |
|
2624 | assert all(i['alt'] == i['title'] == title for i in imgs) |
|
2625 | assert len(imgs) <= 1, imgs |
|
2626 | return { |
|
2627 | 'img': [i['src'] for i in imgs], |
|
2628 | 'title': title, |
|
2629 | 'author': author, |
|
2630 | 'day': day.day, |
|
2631 | 'month': day.month, |
|
2632 | 'year': day.year |
|
2633 | } |
|
2634 | ||
2635 | ||
2636 | class BiterComics(GenericNavigableComic): |
|
2637 | """Class to retrieve Biter Comics.""" |
|
2638 | name = "biter" |
|
2639 | long_name = "Biter Comics" |
|
2640 | url = "http://www.bitercomics.com" |
|
@@ 2264-2289 (lines=26) @@ | ||
2261 | class HappleTea(GenericNavigableComic): |
|
2262 | """Class to retrieve Happle Tea Comics.""" |
|
2263 | name = 'happletea' |
|
2264 | long_name = 'Happle Tea' |
|
2265 | url = 'http://www.happletea.com' |
|
2266 | get_first_comic_link = get_a_navi_navifirst |
|
2267 | get_navi_link = get_link_rel_next |
|
2268 | ||
2269 | @classmethod |
|
2270 | def get_comic_info(cls, soup, link): |
|
2271 | """Get information about a particular comics.""" |
|
2272 | imgs = soup.find('div', id='comic').find_all('img') |
|
2273 | post = soup.find('div', class_='post-content') |
|
2274 | title = post.find('h2', class_='post-title').string |
|
2275 | author = post.find('a', rel='author').string |
|
2276 | date_str = post.find('span', class_='post-date').string |
|
2277 | day = string_to_date(date_str, "%B %d, %Y") |
|
2278 | assert all(i['alt'] == i['title'] for i in imgs) |
|
2279 | return { |
|
2280 | 'title': title, |
|
2281 | 'img': [i['src'] for i in imgs], |
|
2282 | 'alt': ''.join(i['alt'] for i in imgs), |
|
2283 | 'month': day.month, |
|
2284 | 'year': day.year, |
|
2285 | 'day': day.day, |
|
2286 | 'author': author, |
|
2287 | } |
|
2288 | ||
2289 | ||
2290 | class RockPaperScissors(GenericNavigableComic): |
|
2291 | """Class to retrieve Rock Paper Scissors comics.""" |
|
2292 | name = 'rps' |
|
@@ 2445-2469 (lines=25) @@ | ||
2442 | """Get url corresponding to an archive element.""" |
|
2443 | _, td_comic, td_date, _ = tr.find_all('td') |
|
2444 | link = td_comic.find('a') |
|
2445 | return urljoin_wrapper(cls.url, link['href']) |
|
2446 | ||
2447 | @classmethod |
|
2448 | def get_comic_info(cls, soup, tr): |
|
2449 | """Get information about a particular comics.""" |
|
2450 | td_num, td_comic, td_date, _ = tr.find_all('td') |
|
2451 | num = int(td_num.string) |
|
2452 | link = td_comic.find('a') |
|
2453 | title = link.string |
|
2454 | imgs = soup.find_all('img', id='comic_image') |
|
2455 | date_str = td_date.string |
|
2456 | day = string_to_date(remove_st_nd_rd_th_from_date(date_str), "%B %d, %Y, %I:%M %p") |
|
2457 | assert len(imgs) == 1, imgs |
|
2458 | assert all(i.get('alt') == i.get('title') for i in imgs) |
|
2459 | return { |
|
2460 | 'num': num, |
|
2461 | 'title': title, |
|
2462 | 'alt': imgs[0].get('alt', ''), |
|
2463 | 'img': [urljoin_wrapper(cls.url, i['src']) for i in imgs], |
|
2464 | 'month': day.month, |
|
2465 | 'year': day.year, |
|
2466 | 'day': day.day, |
|
2467 | } |
|
2468 | ||
2469 | ||
2470 | class LonnieMillsap(GenericNavigableComic): |
|
2471 | """Class to retrieve Lonnie Millsap's comics.""" |
|
2472 | name = 'millsap' |
|
@@ 3306-3329 (lines=24) @@ | ||
3303 | return { |
|
3304 | 'img': [i['src'] for i in imgs], |
|
3305 | 'title': title, |
|
3306 | 'month': day.month, |
|
3307 | 'year': day.year, |
|
3308 | 'day': day.day, |
|
3309 | } |
|
3310 | ||
3311 | ||
3312 | class TheMeerkatguy(GenericNavigableComic): |
|
3313 | """Class to retrieve The Meerkatguy comics.""" |
|
3314 | long_name = 'The Meerkatguy' |
|
3315 | url = 'http://www.themeerkatguy.com' |
|
3316 | name = 'meerkatguy' |
|
3317 | get_first_comic_link = get_a_comicnavbase_comicnavfirst |
|
3318 | get_navi_link = get_a_comicnavbase_comicnavnext |
|
3319 | ||
3320 | @classmethod |
|
3321 | def get_comic_info(cls, soup, link): |
|
3322 | """Get information about a particular comics.""" |
|
3323 | title = soup.find('title').string |
|
3324 | imgs = soup.find_all('meta', property='og:image') |
|
3325 | return { |
|
3326 | 'img': [i['content'] for i in imgs], |
|
3327 | 'title': title, |
|
3328 | } |
|
3329 | ||
3330 | ||
3331 | class Ubertool(GenericNavigableComic): |
|
3332 | """Class to retrieve Ubertool comics.""" |
|
@@ 3607-3627 (lines=21) @@ | ||
3604 | ||
3605 | @classmethod |
|
3606 | def get_navi_link(cls, last_soup, next_): |
|
3607 | """Get link to next or previous comic.""" |
|
3608 | return last_soup.find('a', id='Blog1_blog-pager-newer-link' if next_ else 'Blog1_blog-pager-older-link') |
|
3609 | ||
3610 | ||
3611 | class TuMourrasMoinsBete(GenericBlogspotComic): |
|
3612 | """Class to retrieve Tu Mourras Moins Bete comics.""" |
|
3613 | name = 'mourrasmoinsbete' |
|
3614 | long_name = 'Tu Mourras Moins Bete' |
|
3615 | url = 'http://tumourrasmoinsbete.blogspot.fr' |
|
3616 | _categories = ('FRANCAIS', ) |
|
3617 | first_url = 'http://tumourrasmoinsbete.blogspot.fr/2008/06/essai.html' |
|
3618 | ||
3619 | @classmethod |
|
3620 | def get_comic_info(cls, soup, link): |
|
3621 | """Get information about a particular comics.""" |
|
3622 | title = soup.find('title').string |
|
3623 | imgs = soup.find('div', itemprop='description articleBody').find_all('img') |
|
3624 | author = soup.find('span', itemprop='author').string |
|
3625 | return { |
|
3626 | 'img': [i['src'] for i in imgs], |
|
3627 | 'author': author, |
|
3628 | 'title': title, |
|
3629 | } |
|
3630 | ||
@@ 3263-3283 (lines=21) @@ | ||
3260 | url = 'http://www.sheldoncomics.com' |
|
3261 | ||
3262 | @classmethod |
|
3263 | def get_first_comic_link(cls): |
|
3264 | """Get link to first comics.""" |
|
3265 | return get_soup_at_url(cls.url).find("a", id="nav-first") |
|
3266 | ||
3267 | @classmethod |
|
3268 | def get_navi_link(cls, last_soup, next_): |
|
3269 | """Get link to next or previous comic.""" |
|
3270 | for link in last_soup.find_all("a", id="nav-next" if next_ else "nav-prev"): |
|
3271 | if link['href'] != 'http://www.sheldoncomics.com': |
|
3272 | return link |
|
3273 | return None |
|
3274 | ||
3275 | @classmethod |
|
3276 | def get_comic_info(cls, soup, link): |
|
3277 | """Get information about a particular comics.""" |
|
3278 | imgs = soup.find("div", id="comic-foot").find_all("img") |
|
3279 | assert all(i['alt'] == i['title'] for i in imgs) |
|
3280 | assert len(imgs) == 1, imgs |
|
3281 | title = imgs[0]['title'] |
|
3282 | return { |
|
3283 | 'title': title, |
|
3284 | 'img': [i['src'] for i in imgs], |
|
3285 | } |
|
3286 | ||
@@ 2053-2079 (lines=27) @@ | ||
2050 | class CompletelySeriousComics(GenericNavigableComic): |
|
2051 | """Class to retrieve Completely Serious comics.""" |
|
2052 | name = 'completelyserious' |
|
2053 | long_name = 'Completely Serious Comics' |
|
2054 | url = 'http://completelyseriouscomics.com' |
|
2055 | get_first_comic_link = get_a_navi_navifirst |
|
2056 | get_navi_link = get_a_navi_navinext |
|
2057 | ||
2058 | @classmethod |
|
2059 | def get_comic_info(cls, soup, link): |
|
2060 | """Get information about a particular comics.""" |
|
2061 | title = soup.find('h2', class_='post-title').string |
|
2062 | author = soup.find('span', class_='post-author').contents[1].string |
|
2063 | date_str = soup.find('span', class_='post-date').string |
|
2064 | day = string_to_date(date_str, '%B %d, %Y') |
|
2065 | imgs = soup.find('div', class_='comicpane').find_all('img') |
|
2066 | assert imgs |
|
2067 | alt = imgs[0]['title'] |
|
2068 | assert all(i['title'] == i['alt'] == alt for i in imgs) |
|
2069 | return { |
|
2070 | 'month': day.month, |
|
2071 | 'year': day.year, |
|
2072 | 'day': day.day, |
|
2073 | 'img': [i['src'] for i in imgs], |
|
2074 | 'title': title, |
|
2075 | 'alt': alt, |
|
2076 | 'author': author, |
|
2077 | } |
|
2078 | ||
2079 | ||
2080 | class PoorlyDrawnLines(GenericListableComic): |
|
2081 | """Class to retrieve Poorly Drawn Lines comics.""" |
|
2082 | # Also on http://pdlcomics.tumblr.com |