Code Duplication    Length = 21-27 lines in 18 locations

comics.py 18 locations

@@ 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
class GenericBoumerie(GenericNavigableComic):
2893
    """Generic class to retrieve Boumeries comics in different languages."""
2894
    # Also on http://boumeries.tumblr.com
2895
    get_first_comic_link = get_a_navi_navifirst
2896
    get_navi_link = get_link_rel_next
2897
    date_format = NotImplemented
2898
    lang = NotImplemented
2899
2900
    @classmethod
2901
    def get_comic_info(cls, soup, link):
2902
        """Get information about a particular comics."""
2903
        title = soup.find('h2', class_='post-title').string
2904
        short_url = soup.find('link', rel='shortlink')['href']
2905
        author = soup.find("span", class_="post-author").find("a").string
2906
        date_str = soup.find('span', class_='post-date').string
2907
        day = string_to_date(date_str, cls.date_format, cls.lang)
2908
        imgs = soup.find('div', id='comic').find_all('img')
2909
        assert all(i['alt'] == i['title'] for i in imgs)
2910
        return {
2911
            'short_url': short_url,
2912
            'img': [i['src'] for i in imgs],
2913
            'title': title,
2914
            'author': author,
2915
            'month': day.month,
2916
            'year': day.year,
2917
            'day': day.day,
2918
        }
2919
2920
2921
class BoumerieEn(GenericBoumerie):
2922
    """Class to retrieve Boumeries comics in English."""
@@ 2641-2666 (lines=26) @@
2638
class TheAwkwardYeti(GenericNavigableComic):
2639
    """Class to retrieve The Awkward Yeti comics."""
2640
    # Also on http://www.gocomics.com/the-awkward-yeti
2641
    # Also on http://larstheyeti.tumblr.com
2642
    # Also on https://tapastic.com/series/TheAwkwardYeti
2643
    name = 'yeti'
2644
    long_name = 'The Awkward Yeti'
2645
    url = 'http://theawkwardyeti.com'
2646
    _categories = ('YETI', )
2647
    get_first_comic_link = get_a_navi_navifirst
2648
    get_navi_link = get_link_rel_next
2649
2650
    @classmethod
2651
    def get_comic_info(cls, soup, link):
2652
        """Get information about a particular comics."""
2653
        title = soup.find('h2', class_='post-title').string
2654
        date_str = soup.find("span", class_="post-date").string
2655
        day = string_to_date(date_str, "%B %d, %Y")
2656
        imgs = soup.find("div", id="comic").find_all("img")
2657
        assert all(idx > 0 or i['alt'] == i['title'] for idx, i in enumerate(imgs))
2658
        return {
2659
            'img': [i['src'] for i in imgs],
2660
            'title': title,
2661
            'day': day.day,
2662
            'month': day.month,
2663
            'year': day.year
2664
        }
2665
2666
2667
class PleasantThoughts(GenericNavigableComic):
2668
    """Class to retrieve Pleasant Thoughts comics."""
2669
    name = 'pleasant'
@@ 2554-2579 (lines=26) @@
2551
class GerbilWithAJetpack(GenericNavigableComic):
2552
    """Class to retrieve GerbilWithAJetpack comics."""
2553
    name = 'gerbil'
2554
    long_name = 'Gerbil With A Jetpack'
2555
    url = 'http://gerbilwithajetpack.com'
2556
    get_first_comic_link = get_a_navi_navifirst
2557
    get_navi_link = get_a_rel_next
2558
2559
    @classmethod
2560
    def get_comic_info(cls, soup, link):
2561
        """Get information about a particular comics."""
2562
        title = soup.find('h2', class_='post-title').string
2563
        author = soup.find("span", class_="post-author").find("a").string
2564
        date_str = soup.find("span", class_="post-date").string
2565
        day = string_to_date(date_str, "%B %d, %Y")
2566
        imgs = soup.find("div", id="comic").find_all("img")
2567
        alt = imgs[0]['alt']
2568
        assert all(i['alt'] == i['title'] == alt for i in imgs)
2569
        return {
2570
            'img': [i['src'] for i in imgs],
2571
            'title': title,
2572
            'alt': alt,
2573
            'author': author,
2574
            'day': day.day,
2575
            'month': day.month,
2576
            'year': day.year
2577
        }
2578
2579
2580
class EveryDayBlues(GenericDeletedComic, GenericNavigableComic):
2581
    """Class to retrieve EveryDayBlues Comics."""
2582
    name = "blues"
@@ 2583-2607 (lines=25) @@
2580
class EveryDayBlues(GenericDeletedComic, GenericNavigableComic):
2581
    """Class to retrieve EveryDayBlues Comics."""
2582
    name = "blues"
2583
    long_name = "Every Day Blues"
2584
    url = "http://everydayblues.net"
2585
    get_first_comic_link = get_a_navi_navifirst
2586
    get_navi_link = get_link_rel_next
2587
2588
    @classmethod
2589
    def get_comic_info(cls, soup, link):
2590
        """Get information about a particular comics."""
2591
        title = soup.find("h2", class_="post-title").string
2592
        author = soup.find("span", class_="post-author").find("a").string
2593
        date_str = soup.find("span", class_="post-date").string
2594
        day = string_to_date(date_str, "%d. %B %Y", "de_DE.utf8")
2595
        imgs = soup.find("div", id="comic").find_all("img")
2596
        assert all(i['alt'] == i['title'] == title for i in imgs)
2597
        assert len(imgs) <= 1, imgs
2598
        return {
2599
            'img': [i['src'] for i in imgs],
2600
            'title': title,
2601
            'author': author,
2602
            'day': day.day,
2603
            'month': day.month,
2604
            'year': day.year
2605
        }
2606
2607
2608
class BiterComics(GenericNavigableComic):
2609
    """Class to retrieve Biter Comics."""
2610
    name = "biter"
@@ 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 BiterComics(GenericNavigableComic):
2609
    """Class to retrieve Biter Comics."""
2610
    name = "biter"
2611
    long_name = "Biter Comics"
2612
    url = "http://www.bitercomics.com"
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("h1", class_="entry-title").string
2620
        author = soup.find("span", class_="author vcard").find("a").string
2621
        date_str = soup.find("span", class_="entry-date").string
2622
        day = string_to_date(date_str, "%B %d, %Y")
2623
        imgs = soup.find("div", id="comic").find_all("img")
2624
        assert all(i['alt'] == i['title'] for i in imgs)
2625
        assert len(imgs) == 1, imgs
2626
        alt = imgs[0]['alt']
2627
        return {
2628
            'img': [i['src'] for i in imgs],
2629
            'title': title,
2630
            'alt': alt,
2631
            'author': author,
2632
            'day': day.day,
2633
            'month': day.month,
2634
            'year': day.year
2635
        }
2636
2637
2638
class TheAwkwardYeti(GenericNavigableComic):
2639
    """Class to retrieve The Awkward Yeti comics."""
2640
    # Also on http://www.gocomics.com/the-awkward-yeti
@@ 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
class LonnieMillsap(GenericNavigableComic):
2443
    """Class to retrieve Lonnie Millsap's comics."""
2444
    name = 'millsap'
2445
    long_name = 'Lonnie Millsap'
2446
    url = 'http://www.lonniemillsap.com'
2447
    get_navi_link = get_link_rel_next
2448
    get_first_comic_link = simulate_first_link
2449
    first_url = 'http://www.lonniemillsap.com/?p=42'
2450
2451
    @classmethod
2452
    def get_comic_info(cls, soup, link):
2453
        """Get information about a particular comics."""
2454
        title = soup.find('h2', class_='post-title').string
2455
        post = soup.find('div', class_='post-content')
2456
        author = post.find("span", class_="post-author").find("a").string
2457
        date_str = post.find("span", class_="post-date").string
2458
        day = string_to_date(date_str, "%B %d, %Y")
2459
        imgs = post.find("div", class_="entry").find_all("img")
2460
        return {
2461
            'title': title,
2462
            'author': author,
2463
            'img': [i['src'] for i in imgs],
2464
            'month': day.month,
2465
            'year': day.year,
2466
            'day': day.day,
2467
        }
2468
2469
2470
class LinsEditions(GenericDeletedComic):  # Permanently moved to warandpeas
2471
    """Class to retrieve L.I.N.S. Editions comics."""
2472
    # Also on https://linscomics.tumblr.com
@@ 3306-3329 (lines=24) @@
3303
class Ubertool(GenericNavigableComic):
3304
    """Class to retrieve Ubertool comics."""
3305
    # Also on https://ubertool.tumblr.com
3306
    # Also on https://tapastic.com/series/ubertool
3307
    name = 'ubertool'
3308
    long_name = 'Ubertool'
3309
    url = 'http://ubertoolcomic.com'
3310
    _categories = ('UBERTOOL', )
3311
    get_first_comic_link = get_a_comicnavbase_comicnavfirst
3312
    get_navi_link = get_a_comicnavbase_comicnavnext
3313
3314
    @classmethod
3315
    def get_comic_info(cls, soup, link):
3316
        """Get information about a particular comics."""
3317
        title = soup.find('h2', class_='post-title').string
3318
        date_str = soup.find('span', class_='post-date').string
3319
        day = string_to_date(date_str, "%B %d, %Y")
3320
        imgs = soup.find('div', id='comic').find_all('img')
3321
        return {
3322
            'img': [i['src'] for i in imgs],
3323
            'title': title,
3324
            'month': day.month,
3325
            'year': day.year,
3326
            'day': day.day,
3327
        }
3328
3329
3330
class EarthExplodes(GenericNavigableComic):
3331
    """Class to retrieve The Earth Explodes comics."""
3332
    name = 'earthexplodes'
@@ 3607-3627 (lines=21) @@
3604
class Octopuns(GenericBlogspotComic):
3605
    """Class to retrieve Octopuns comics."""
3606
    # Also on http://octopuns.tumblr.com
3607
    name = 'octopuns'
3608
    long_name = 'Octopuns'
3609
    url = 'http://www.octopuns.net'  # or http://octopuns.blogspot.fr/
3610
    first_url = 'http://octopuns.blogspot.com/2010/12/17122010-always-read-label.html'
3611
3612
    @classmethod
3613
    def get_comic_info(cls, soup, link):
3614
        """Get information about a particular comics."""
3615
        title = soup.find('h3', class_='post-title entry-title').string
3616
        date_str = soup.find('h2', class_='date-header').string
3617
        day = string_to_date(date_str, "%A, %B %d, %Y")
3618
        imgs = soup.find_all('link', rel='image_src')
3619
        return {
3620
            'img': [i['href'] for i in imgs],
3621
            'title': title,
3622
            'day': day.day,
3623
            'month': day.month,
3624
            'year': day.year,
3625
        }
3626
3627
3628
class GeekAndPoke(GenericNavigableComic):
3629
    """Class to retrieve Geek And Poke comics."""
3630
    name = 'geek'
@@ 3263-3283 (lines=21) @@
3260
class ManVersusManatee(GenericNavigableComic):
3261
    """Class to retrieve Man Versus Manatee comics."""
3262
    url = 'http://manvsmanatee.com'
3263
    name = 'manvsmanatee'
3264
    long_name = 'Man Versus Manatee'
3265
    get_first_comic_link = get_a_comicnavbase_comicnavfirst
3266
    get_navi_link = get_a_comicnavbase_comicnavnext
3267
3268
    @classmethod
3269
    def get_comic_info(cls, soup, link):
3270
        """Get information about a particular comics."""
3271
        title = soup.find('h2', class_='post-title').string
3272
        imgs = soup.find('div', id='comic').find_all('img')
3273
        date_str = soup.find('span', class_='post-date').string
3274
        day = string_to_date(date_str, "%B %d, %Y")
3275
        return {
3276
            'img': [i['src'] for i in imgs],
3277
            'title': title,
3278
            'month': day.month,
3279
            'year': day.year,
3280
            'day': day.day,
3281
        }
3282
3283
3284
class TheMeerkatguy(GenericNavigableComic):
3285
    """Class to retrieve The Meerkatguy comics."""
3286
    long_name = 'The Meerkatguy'
@@ 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