Code Duplication    Length = 21-29 lines in 23 locations

comics.py 23 locations

@@ 1888-1914 (lines=27) @@
1885
1886
1887
class PicturesInBoxes(GenericNavigableComic):
1888
    """Class to retrieve Pictures In Boxes comics."""
1889
    # Also on https://picturesinboxescomic.tumblr.com
1890
    name = 'picturesinboxes'
1891
    long_name = 'Pictures in Boxes'
1892
    url = 'http://www.picturesinboxes.com'
1893
    get_navi_link = get_a_navi_navinext
1894
    get_first_comic_link = simulate_first_link
1895
    first_url = 'http://www.picturesinboxes.com/2013/10/26/tetris/'
1896
1897
    @classmethod
1898
    def get_comic_info(cls, soup, link):
1899
        """Get information about a particular comics."""
1900
        title = soup.find('h2', class_='post-title').string
1901
        author = soup.find("span", class_="post-author").find("a").string
1902
        date_str = soup.find('span', class_='post-date').string
1903
        day = string_to_date(date_str, '%B %d, %Y')
1904
        imgs = soup.find('div', class_='comicpane').find_all('img')
1905
        assert imgs
1906
        assert all(i['title'] == i['alt'] == title for i in imgs)
1907
        return {
1908
            'day': day.day,
1909
            'month': day.month,
1910
            'year': day.year,
1911
            'img': [i['src'] for i in imgs],
1912
            'title': title,
1913
            'author': author,
1914
        }
1915
1916
1917
class Penmen(GenericNavigableComic):
@@ 955-981 (lines=27) @@
952
            'day': day.day,
953
        }
954
955
956
class ImogenQuest(GenericNavigableComic):
957
    """Class to retrieve Imogen Quest comics."""
958
    # Also on http://imoquest.tumblr.com
959
    name = 'imogen'
960
    long_name = 'Imogen Quest'
961
    url = 'http://imogenquest.net'
962
    get_first_comic_link = get_div_navfirst_a
963
    get_navi_link = get_a_rel_next
964
965
    @classmethod
966
    def get_comic_info(cls, soup, link):
967
        """Get information about a particular comics."""
968
        title = soup.find('h2', class_='post-title').string
969
        author = soup.find("span", class_="post-author").find("a").string
970
        date_str = soup.find('span', class_='post-date').string
971
        day = string_to_date(date_str, '%B %d, %Y')
972
        imgs = soup.find('div', class_='comicpane').find_all('img')
973
        assert all(i['alt'] == i['title'] for i in imgs)
974
        title2 = imgs[0]['title']
975
        return {
976
            'day': day.day,
977
            'month': day.month,
978
            'year': day.year,
979
            'img': [i['src'] for i in imgs],
980
            'title': title,
981
            'title2': title2,
982
            'author': author,
983
        }
984
@@ 2589-2614 (lines=26) @@
2586
2587
2588
class TheAwkwardYeti(GenericNavigableComic):
2589
    """Class to retrieve The Awkward Yeti comics."""
2590
    # Also on http://www.gocomics.com/the-awkward-yeti
2591
    # Also on http://larstheyeti.tumblr.com
2592
    # Also on https://tapastic.com/series/TheAwkwardYeti
2593
    name = 'yeti'
2594
    long_name = 'The Awkward Yeti'
2595
    url = 'http://theawkwardyeti.com'
2596
    _categories = ('YETI', )
2597
    get_first_comic_link = get_a_navi_navifirst
2598
    get_navi_link = get_link_rel_next
2599
2600
    @classmethod
2601
    def get_comic_info(cls, soup, link):
2602
        """Get information about a particular comics."""
2603
        title = soup.find('h2', class_='post-title').string
2604
        date_str = soup.find("span", class_="post-date").string
2605
        day = string_to_date(date_str, "%B %d, %Y")
2606
        imgs = soup.find("div", id="comic").find_all("img")
2607
        assert all(idx > 0 or i['alt'] == i['title'] for idx, i in enumerate(imgs))
2608
        return {
2609
            'img': [i['src'] for i in imgs],
2610
            'title': title,
2611
            'day': day.day,
2612
            'month': day.month,
2613
            'year': day.year
2614
        }
2615
2616
2617
class PleasantThoughts(GenericNavigableComic):
@@ 2843-2867 (lines=25) @@
2840
2841
2842
class GenericBoumerie(GenericNavigableComic):
2843
    """Generic class to retrieve Boumeries comics in different languages."""
2844
    get_first_comic_link = get_a_navi_navifirst
2845
    get_navi_link = get_link_rel_next
2846
    date_format = NotImplemented
2847
    lang = NotImplemented
2848
2849
    @classmethod
2850
    def get_comic_info(cls, soup, link):
2851
        """Get information about a particular comics."""
2852
        title = soup.find('h2', class_='post-title').string
2853
        short_url = soup.find('link', rel='shortlink')['href']
2854
        author = soup.find("span", class_="post-author").find("a").string
2855
        date_str = soup.find('span', class_='post-date').string
2856
        day = string_to_date(date_str, cls.date_format, cls.lang)
2857
        imgs = soup.find('div', id='comic').find_all('img')
2858
        assert all(i['alt'] == i['title'] for i in imgs)
2859
        return {
2860
            'short_url': short_url,
2861
            'img': [i['src'] for i in imgs],
2862
            'title': title,
2863
            'author': author,
2864
            'month': day.month,
2865
            'year': day.year,
2866
            'day': day.day,
2867
        }
2868
2869
2870
class BoumerieEn(GenericBoumerie):
@@ 2531-2555 (lines=25) @@
2528
2529
2530
class EveryDayBlues(GenericDeletedComic, GenericNavigableComic):
2531
    """Class to retrieve EveryDayBlues Comics."""
2532
    name = "blues"
2533
    long_name = "Every Day Blues"
2534
    url = "http://everydayblues.net"
2535
    get_first_comic_link = get_a_navi_navifirst
2536
    get_navi_link = get_link_rel_next
2537
2538
    @classmethod
2539
    def get_comic_info(cls, soup, link):
2540
        """Get information about a particular comics."""
2541
        title = soup.find("h2", class_="post-title").string
2542
        author = soup.find("span", class_="post-author").find("a").string
2543
        date_str = soup.find("span", class_="post-date").string
2544
        day = string_to_date(date_str, "%d. %B %Y", "de_DE.utf8")
2545
        imgs = soup.find("div", id="comic").find_all("img")
2546
        assert all(i['alt'] == i['title'] == title for i in imgs)
2547
        assert len(imgs) <= 1
2548
        return {
2549
            'img': [i['src'] for i in imgs],
2550
            'title': title,
2551
            'author': author,
2552
            'day': day.day,
2553
            'month': day.month,
2554
            'year': day.year
2555
        }
2556
2557
2558
class BiterComics(GenericNavigableComic):
@@ 1776-1800 (lines=25) @@
1773
1774
1775
class MouseBearComedy(GenericComicNotWorking):  # Website has changed
1776
    """Class to retrieve Mouse Bear Comedy comics."""
1777
    # Also on http://mousebearcomedy.tumblr.com
1778
    name = 'mousebear'
1779
    long_name = 'Mouse Bear Comedy'
1780
    url = 'http://www.mousebearcomedy.com'
1781
    get_first_comic_link = get_a_navi_navifirst
1782
    get_navi_link = get_a_navi_comicnavnext_navinext
1783
1784
    @classmethod
1785
    def get_comic_info(cls, soup, link):
1786
        """Get information about a particular comics."""
1787
        title = soup.find('h2', class_='post-title').string
1788
        author = soup.find("span", class_="post-author").find("a").string
1789
        date_str = soup.find("span", class_="post-date").string
1790
        day = string_to_date(date_str, '%B %d, %Y')
1791
        imgs = soup.find("div", id="comic").find_all("img")
1792
        assert all(i['alt'] == i['title'] == title for i in imgs)
1793
        return {
1794
            'day': day.day,
1795
            'month': day.month,
1796
            'year': day.year,
1797
            'img': [i['src'] for i in imgs],
1798
            'title': title,
1799
            'author': author,
1800
        }
1801
1802
1803
class BigFootJustice(GenericNavigableComic):
@@ 1184-1207 (lines=24) @@
1181
    long_name = 'Boulet Corp English'
1182
    url = 'http://english.bouletcorp.com'
1183
1184
1185
class AmazingSuperPowers(GenericNavigableComic):
1186
    """Class to retrieve Amazing Super Powers comics."""
1187
    name = 'asp'
1188
    long_name = 'Amazing Super Powers'
1189
    url = 'http://www.amazingsuperpowers.com'
1190
    get_first_comic_link = get_a_navi_navifirst
1191
    get_navi_link = get_a_navi_navinext
1192
1193
    @classmethod
1194
    def get_comic_info(cls, soup, link):
1195
        """Get information about a particular comics."""
1196
        author = soup.find("span", class_="post-author").find("a").string
1197
        date_str = soup.find('span', class_='post-date').string
1198
        day = string_to_date(date_str, "%B %d, %Y")
1199
        imgs = soup.find('div', id='comic').find_all('img')
1200
        title = ' '.join(i['title'] for i in imgs)
1201
        assert all(i['alt'] == i['title'] for i in imgs)
1202
        return {
1203
            'title': title,
1204
            'author': author,
1205
            'img': [img['src'] for img in imgs],
1206
            'day': day.day,
1207
            'month': day.month,
1208
            'year': day.year
1209
        }
1210
@@ 701-724 (lines=24) @@
698
            'day': day.day,
699
        }
700
701
702
class OneOneOneOneComic(GenericComicNotWorking, GenericNavigableComic):
703
    """Class to retrieve 1111 Comics."""
704
    # Also on http://comics1111.tumblr.com
705
    # Also on https://tapastic.com/series/1111-Comics
706
    name = '1111'
707
    long_name = '1111 Comics'
708
    url = 'http://www.1111comics.me'
709
    _categories = ('ONEONEONEONE', )
710
    get_first_comic_link = get_div_navfirst_a
711
    get_navi_link = get_link_rel_next
712
713
    @classmethod
714
    def get_comic_info(cls, soup, link):
715
        """Get information about a particular comics."""
716
        title = soup.find('h1', class_='comic-title').find('a').string
717
        date_str = soup.find('header', class_='comic-meta entry-meta').find('a').string
718
        day = string_to_date(date_str, "%B %d, %Y")
719
        imgs = soup.find_all('meta', property='og:image')
720
        return {
721
            'title': title,
722
            'month': day.month,
723
            'year': day.year,
724
            'day': day.day,
725
            'img': [i['content'] for i in imgs],
726
        }
727
@@ 929-951 (lines=23) @@
926
            'img': [i['src'] for i in imgs],
927
        }
928
929
930
class TheGentlemanArmchair(GenericNavigableComic):
931
    """Class to retrieve The Gentleman Armchair comics."""
932
    name = 'gentlemanarmchair'
933
    long_name = 'The Gentleman Armchair'
934
    url = 'http://thegentlemansarmchair.com'
935
    get_first_comic_link = get_a_navi_navifirst
936
    get_navi_link = get_link_rel_next
937
938
    @classmethod
939
    def get_comic_info(cls, soup, link):
940
        """Get information about a particular comics."""
941
        title = soup.find('h2', class_='post-title').string
942
        author = soup.find("span", class_="post-author").find("a").string
943
        date_str = soup.find('span', class_='post-date').string
944
        day = string_to_date(date_str, "%B %d, %Y")
945
        imgs = soup.find('div', id='comic').find_all('img')
946
        return {
947
            'img': [i['src'] for i in imgs],
948
            'title': title,
949
            'author': author,
950
            'month': day.month,
951
            'year': day.year,
952
            'day': day.day,
953
        }
954
@@ 728-749 (lines=22) @@
725
            'img': [i['content'] for i in imgs],
726
        }
727
728
729
class AngryAtNothing(GenericDeletedComic, GenericNavigableComic):
730
    """Class to retrieve Angry at Nothing comics."""
731
    # Also on http://tapastic.com/series/Comics-yeah-definitely-comics-
732
    # Also on http://angryatnothing.tumblr.com
733
    name = 'angry'
734
    long_name = 'Angry At Nothing'
735
    url = 'http://www.angryatnothing.net'
736
    get_first_comic_link = get_div_navfirst_a
737
    get_navi_link = get_a_rel_next
738
739
    @classmethod
740
    def get_comic_info(cls, soup, link):
741
        """Get information about a particular comics."""
742
        title = soup.find('h1', class_='comic-title').find('a').string
743
        date_str = soup.find('header', class_='comic-meta entry-meta').find('a').string
744
        day = string_to_date(date_str, "%B %d, %Y")
745
        imgs = soup.find_all('meta', property='og:image')
746
        return {
747
            'title': title,
748
            'month': day.month,
749
            'year': day.year,
750
            'day': day.day,
751
            'img': [i['content'] for i in imgs],
752
        }
@@ 2700-2728 (lines=29) @@
2697
2698
2699
class TalesOfAbsurdity(GenericNavigableComic):
2700
    """Class to retrieve Tales Of Absurdity comics."""
2701
    # Also on http://tapastic.com/series/Tales-Of-Absurdity
2702
    # Also on http://talesofabsurdity.tumblr.com
2703
    name = 'absurdity'
2704
    long_name = 'Tales of Absurdity'
2705
    url = 'http://talesofabsurdity.com'
2706
    _categories = ('ABSURDITY', )
2707
    get_first_comic_link = get_a_navi_navifirst
2708
    get_navi_link = get_a_navi_comicnavnext_navinext
2709
2710
    @classmethod
2711
    def get_comic_info(cls, soup, link):
2712
        """Get information about a particular comics."""
2713
        title = soup.find('h2', class_='post-title').string
2714
        author = soup.find("span", class_="post-author").find("a").string
2715
        date_str = soup.find("span", class_="post-date").string
2716
        day = string_to_date(date_str, "%B %d, %Y")
2717
        imgs = soup.find("div", id="comic").find_all("img")
2718
        assert all(i['alt'] == i['title'] for i in imgs)
2719
        alt = imgs[0]['alt'] if imgs else ""
2720
        return {
2721
            'img': [i['src'] for i in imgs],
2722
            'title': title,
2723
            'alt': alt,
2724
            'author': author,
2725
            'day': day.day,
2726
            'month': day.month,
2727
            'year': day.year
2728
        }
2729
2730
2731
class EndlessOrigami(GenericComicNotWorking, GenericNavigableComic):  # Nav not working
@@ 2638-2666 (lines=29) @@
2635
2636
2637
class MisterAndMe(GenericNavigableComic):
2638
    """Class to retrieve Mister & Me Comics."""
2639
    # Also on http://www.gocomics.com/mister-and-me
2640
    # Also on https://tapastic.com/series/Mister-and-Me
2641
    name = 'mister'
2642
    long_name = 'Mister & Me'
2643
    url = 'http://www.mister-and-me.com'
2644
    get_first_comic_link = get_a_comicnavbase_comicnavfirst
2645
    get_navi_link = get_link_rel_next
2646
2647
    @classmethod
2648
    def get_comic_info(cls, soup, link):
2649
        """Get information about a particular comics."""
2650
        title = soup.find('h2', class_='post-title').string
2651
        author = soup.find("span", class_="post-author").find("a").string
2652
        date_str = soup.find("span", class_="post-date").string
2653
        day = string_to_date(date_str, "%B %d, %Y")
2654
        imgs = soup.find("div", id="comic").find_all("img")
2655
        assert all(i['alt'] == i['title'] for i in imgs)
2656
        assert len(imgs) <= 1
2657
        alt = imgs[0]['alt'] if imgs else ""
2658
        return {
2659
            'img': [i['src'] for i in imgs],
2660
            'title': title,
2661
            'alt': alt,
2662
            'author': author,
2663
            'day': day.day,
2664
            'month': day.month,
2665
            'year': day.year
2666
        }
2667
2668
2669
class LastPlaceComics(GenericNavigableComic):
@@ 2924-2950 (lines=27) @@
2921
2922
2923
class Optipess(GenericNavigableComic):
2924
    """Class to retrieve Optipess comics."""
2925
    name = 'optipess'
2926
    long_name = 'Optipess'
2927
    url = 'http://www.optipess.com'
2928
    get_first_comic_link = get_a_navi_navifirst
2929
    get_navi_link = get_link_rel_next
2930
2931
    @classmethod
2932
    def get_comic_info(cls, soup, link):
2933
        """Get information about a particular comics."""
2934
        title = soup.find('h2', class_='post-title').string
2935
        author = soup.find("span", class_="post-author").find("a").string
2936
        comic = soup.find('div', id='comic')
2937
        imgs = comic.find_all('img') if comic else []
2938
        alt = imgs[0]['title'] if imgs else ""
2939
        assert all(i['alt'] == i['title'] == alt for i in imgs)
2940
        date_str = soup.find('span', class_='post-date').string
2941
        day = string_to_date(date_str, "%B %d, %Y")
2942
        return {
2943
            'title': title,
2944
            'alt': alt,
2945
            'author': author,
2946
            'img': [i['src'] for i in imgs],
2947
            'month': day.month,
2948
            'year': day.year,
2949
            'day': day.day,
2950
        }
2951
2952
2953
class PainTrainComic(GenericNavigableComic):
@@ 2559-2585 (lines=27) @@
2556
2557
2558
class BiterComics(GenericNavigableComic):
2559
    """Class to retrieve Biter Comics."""
2560
    name = "biter"
2561
    long_name = "Biter Comics"
2562
    url = "http://www.bitercomics.com"
2563
    get_first_comic_link = get_a_navi_navifirst
2564
    get_navi_link = get_link_rel_next
2565
2566
    @classmethod
2567
    def get_comic_info(cls, soup, link):
2568
        """Get information about a particular comics."""
2569
        title = soup.find("h1", class_="entry-title").string
2570
        author = soup.find("span", class_="author vcard").find("a").string
2571
        date_str = soup.find("span", class_="entry-date").string
2572
        day = string_to_date(date_str, "%B %d, %Y")
2573
        imgs = soup.find("div", id="comic").find_all("img")
2574
        assert all(i['alt'] == i['title'] for i in imgs)
2575
        assert len(imgs) == 1
2576
        alt = imgs[0]['alt']
2577
        return {
2578
            'img': [i['src'] for i in imgs],
2579
            'title': title,
2580
            'alt': alt,
2581
            'author': author,
2582
            'day': day.day,
2583
            'month': day.month,
2584
            'year': day.year
2585
        }
2586
2587
2588
class TheAwkwardYeti(GenericNavigableComic):
@@ 2033-2059 (lines=27) @@
2030
2031
2032
class CompletelySeriousComics(GenericNavigableComic):
2033
    """Class to retrieve Completely Serious comics."""
2034
    name = 'completelyserious'
2035
    long_name = 'Completely Serious Comics'
2036
    url = 'http://completelyseriouscomics.com'
2037
    get_first_comic_link = get_a_navi_navifirst
2038
    get_navi_link = get_a_navi_navinext
2039
2040
    @classmethod
2041
    def get_comic_info(cls, soup, link):
2042
        """Get information about a particular comics."""
2043
        title = soup.find('h2', class_='post-title').string
2044
        author = soup.find('span', class_='post-author').contents[1].string
2045
        date_str = soup.find('span', class_='post-date').string
2046
        day = string_to_date(date_str, '%B %d, %Y')
2047
        imgs = soup.find('div', class_='comicpane').find_all('img')
2048
        assert imgs
2049
        alt = imgs[0]['title']
2050
        assert all(i['title'] == i['alt'] == alt for i in imgs)
2051
        return {
2052
            'month': day.month,
2053
            'year': day.year,
2054
            'day': day.day,
2055
            'img': [i['src'] for i in imgs],
2056
            'title': title,
2057
            'alt': alt,
2058
            'author': author,
2059
        }
2060
2061
2062
class PoorlyDrawnLines(GenericListableComic):
@@ 2732-2757 (lines=26) @@
2729
2730
2731
class EndlessOrigami(GenericComicNotWorking, GenericNavigableComic):  # Nav not working
2732
    """Class to retrieve Endless Origami Comics."""
2733
    name = "origami"
2734
    long_name = "Endless Origami"
2735
    url = "http://endlessorigami.com"
2736
    get_first_comic_link = get_a_navi_navifirst
2737
    get_navi_link = get_link_rel_next
2738
2739
    @classmethod
2740
    def get_comic_info(cls, soup, link):
2741
        """Get information about a particular comics."""
2742
        title = soup.find('h2', class_='post-title').string
2743
        author = soup.find("span", class_="post-author").find("a").string
2744
        date_str = soup.find("span", class_="post-date").string
2745
        day = string_to_date(date_str, "%B %d, %Y")
2746
        imgs = soup.find("div", id="comic").find_all("img")
2747
        assert all(i['alt'] == i['title'] for i in imgs)
2748
        alt = imgs[0]['alt'] if imgs else ""
2749
        return {
2750
            'img': [i['src'] for i in imgs],
2751
            'title': title,
2752
            'alt': alt,
2753
            'author': author,
2754
            'day': day.day,
2755
            'month': day.month,
2756
            'year': day.year
2757
        }
2758
2759
2760
class PlanC(GenericNavigableComic):
@@ 2245-2270 (lines=26) @@
2242
2243
2244
class HappleTea(GenericNavigableComic):
2245
    """Class to retrieve Happle Tea Comics."""
2246
    name = 'happletea'
2247
    long_name = 'Happle Tea'
2248
    url = 'http://www.happletea.com'
2249
    get_first_comic_link = get_a_navi_navifirst
2250
    get_navi_link = get_link_rel_next
2251
2252
    @classmethod
2253
    def get_comic_info(cls, soup, link):
2254
        """Get information about a particular comics."""
2255
        imgs = soup.find('div', id='comic').find_all('img')
2256
        post = soup.find('div', class_='post-content')
2257
        title = post.find('h2', class_='post-title').string
2258
        author = post.find('a', rel='author').string
2259
        date_str = post.find('span', class_='post-date').string
2260
        day = string_to_date(date_str, "%B %d, %Y")
2261
        assert all(i['alt'] == i['title'] for i in imgs)
2262
        return {
2263
            'title': title,
2264
            'img': [i['src'] for i in imgs],
2265
            'alt': ''.join(i['alt'] for i in imgs),
2266
            'month': day.month,
2267
            'year': day.year,
2268
            'day': day.day,
2269
            'author': author,
2270
        }
2271
2272
2273
class RockPaperScissors(GenericNavigableComic):
@@ 1918-1943 (lines=26) @@
1915
1916
1917
class Penmen(GenericNavigableComic):
1918
    """Class to retrieve Penmen comics."""
1919
    name = 'penmen'
1920
    long_name = 'Penmen'
1921
    url = 'http://penmen.com'
1922
    get_navi_link = get_link_rel_next
1923
    get_first_comic_link = simulate_first_link
1924
    first_url = 'http://penmen.com/index.php/2016/09/12/penmen-announces-grin-big-brand-clothing/'
1925
1926
    @classmethod
1927
    def get_comic_info(cls, soup, link):
1928
        """Get information about a particular comics."""
1929
        title = soup.find('title').string
1930
        imgs = soup.find('div', class_='entry-content').find_all('img')
1931
        short_url = soup.find('link', rel='shortlink')['href']
1932
        tags = ' '.join(t.string for t in soup.find_all('a', rel='tag'))
1933
        date_str = soup.find('time')['datetime'][:10]
1934
        day = string_to_date(date_str, "%Y-%m-%d")
1935
        return {
1936
            'title': title,
1937
            'short_url': short_url,
1938
            'img': [i['src'] for i in imgs],
1939
            'tags': tags,
1940
            'month': day.month,
1941
            'year': day.year,
1942
            'day': day.day,
1943
        }
1944
1945
1946
class TheDoghouseDiaries(GenericDeletedComic, GenericNavigableComic):
@@ 2401-2425 (lines=25) @@
2398
2399
2400
class LonnieMillsap(GenericNavigableComic):
2401
    """Class to retrieve Lonnie Millsap's comics."""
2402
    name = 'millsap'
2403
    long_name = 'Lonnie Millsap'
2404
    url = 'http://www.lonniemillsap.com'
2405
    get_navi_link = get_link_rel_next
2406
    get_first_comic_link = simulate_first_link
2407
    first_url = 'http://www.lonniemillsap.com/?p=42'
2408
2409
    @classmethod
2410
    def get_comic_info(cls, soup, link):
2411
        """Get information about a particular comics."""
2412
        title = soup.find('h2', class_='post-title').string
2413
        post = soup.find('div', class_='post-content')
2414
        author = post.find("span", class_="post-author").find("a").string
2415
        date_str = post.find("span", class_="post-date").string
2416
        day = string_to_date(date_str, "%B %d, %Y")
2417
        imgs = post.find("div", class_="entry").find_all("img")
2418
        return {
2419
            'title': title,
2420
            'author': author,
2421
            'img': [i['src'] for i in imgs],
2422
            'month': day.month,
2423
            'year': day.year,
2424
            'day': day.day,
2425
        }
2426
2427
2428
class LinsEditions(GenericNavigableComic):
@@ 2121-2145 (lines=25) @@
2118
2119
2120
class ChuckleADuck(GenericNavigableComic):
2121
    """Class to retrieve Chuckle-A-Duck comics."""
2122
    name = 'chuckleaduck'
2123
    long_name = 'Chuckle-A-duck'
2124
    url = 'http://chuckleaduck.com'
2125
    get_first_comic_link = get_div_navfirst_a
2126
    get_navi_link = get_link_rel_next
2127
2128
    @classmethod
2129
    def get_comic_info(cls, soup, link):
2130
        """Get information about a particular comics."""
2131
        date_str = soup.find('span', class_='post-date').string
2132
        day = string_to_date(remove_st_nd_rd_th_from_date(date_str), "%B %d, %Y")
2133
        author = soup.find('span', class_='post-author').string
2134
        div = soup.find('div', id='comic')
2135
        imgs = div.find_all('img') if div else []
2136
        title = imgs[0]['title'] if imgs else ""
2137
        assert all(i['title'] == i['alt'] == title for i in imgs)
2138
        return {
2139
            'month': day.month,
2140
            'year': day.year,
2141
            'day': day.day,
2142
            'img': [i['src'] for i in imgs],
2143
            'title': title,
2144
            'author': author,
2145
        }
2146
2147
2148
class DepressedAlien(GenericNavigableComic):
@@ 3242-3265 (lines=24) @@
3239
    url = 'http://www.earthexplodes.com'
3240
    get_url_from_link = join_cls_url_to_href
3241
    get_first_comic_link = simulate_first_link
3242
    first_url = 'http://www.earthexplodes.com/comics/000/'
3243
3244
    @classmethod
3245
    def get_navi_link(cls, last_soup, next_):
3246
        """Get link to next or previous comic."""
3247
        return last_soup.find('a', id='next' if next_ else 'prev')
3248
3249
    @classmethod
3250
    def get_comic_info(cls, soup, link):
3251
        """Get information about a particular comics."""
3252
        title = soup.find('title').string
3253
        imgs = soup.find('div', id='image').find_all('img')
3254
        alt = imgs[0].get('title', '')
3255
        return {
3256
            'img': [urljoin_wrapper(cls.url, i['src']) for i in imgs],
3257
            'title': title,
3258
            'alt': alt,
3259
        }
3260
3261
3262
class PomComics(GenericNavigableComic):
3263
    """Class to retrieve PomComics."""
3264
    name = 'pom'
3265
    long_name = 'Pom Comics / Piece of Me'
3266
    url = 'http://www.pomcomic.com'
3267
    get_url_from_link = join_cls_url_to_href
3268
@@ 675-697 (lines=23) @@
672
            'tags': tags,
673
        }
674
675
676
class PenelopeBagieu(GenericNavigableComic):
677
    """Class to retrieve comics from Penelope Bagieu's blog."""
678
    name = 'bagieu'
679
    long_name = 'Ma vie est tout a fait fascinante (Bagieu)'
680
    url = 'http://www.penelope-jolicoeur.com'
681
    _categories = ('FRANCAIS', )
682
    get_navi_link = get_link_rel_next
683
    get_first_comic_link = simulate_first_link
684
    first_url = 'http://www.penelope-jolicoeur.com/2007/02/ma-vie-mon-oeuv.html'
685
686
    @classmethod
687
    def get_comic_info(cls, soup, link):
688
        """Get information about a particular comics."""
689
        date_str = soup.find('h2', class_='date-header').string
690
        day = string_to_date(date_str, "%A %d %B %Y", "fr_FR.utf8")
691
        imgs = soup.find('div', class_='entry-body').find_all('img')
692
        title = soup.find('h3', class_='entry-header').string
693
        return {
694
            'title': title,
695
            'img': [i['src'] for i in imgs],
696
            'month': day.month,
697
            'year': day.year,
698
            'day': day.day,
699
        }
700
@@ 2761-2781 (lines=21) @@
2758
2759
2760
class PlanC(GenericNavigableComic):
2761
    """Class to retrieve Plan C comics."""
2762
    name = 'planc'
2763
    long_name = 'Plan C'
2764
    url = 'http://www.plancomic.com'
2765
    get_first_comic_link = get_a_navi_navifirst
2766
    get_navi_link = get_a_navi_comicnavnext_navinext
2767
2768
    @classmethod
2769
    def get_comic_info(cls, soup, link):
2770
        """Get information about a particular comics."""
2771
        title = soup.find('h2', class_='post-title').string
2772
        date_str = soup.find("span", class_="post-date").string
2773
        day = string_to_date(date_str, "%B %d, %Y")
2774
        imgs = soup.find('div', id='comic').find_all('img')
2775
        return {
2776
            'title': title,
2777
            'img': [i['src'] for i in imgs],
2778
            'month': day.month,
2779
            'year': day.year,
2780
            'day': day.day,
2781
        }
2782
2783
2784
class BuniComic(GenericNavigableComic):