<s> import os <EOL> import re <EOL> from parsers . base import SiteParserBase <EOL> from util import getSourceCode <EOL> class Animea ( SiteParserBase ) : <EOL> def downloadAnimea ( self , manga , chapter_start , chapter_end , download_path , download_format ) : <EOL> for current_chapter in range ( chapter_start , chapter_end + <NUM_LIT:1> ) : <EOL> manga_chapter_prefix = manga . lower ( ) . replace ( '<STR_LIT:->' , '<STR_LIT:_>' ) + '<STR_LIT:_>' + str ( current_chapter ) . zfill ( <NUM_LIT:3> ) <EOL> if ( os . path . exists ( download_path + manga_chapter_prefix + '<STR_LIT>' ) or os . path . exists ( download_path + manga_chapter_prefix + '<STR_LIT>' ) ) and overwrite_FLAG == False : <EOL> print ( '<STR_LIT>' + str ( current_chapter ) + '<STR_LIT>' ) <EOL> continue ; <EOL> url = '<STR_LIT>' + manga + '<STR_LIT>' + str ( current_chapter ) + '<STR_LIT>' <EOL> source = getSourceCode ( url ) <EOL> max_pages = int ( re . compile ( '<STR_LIT>' ) . search ( source ) . group ( <NUM_LIT:1> ) ) <EOL> for page in range ( <NUM_LIT:1> , max_pages + <NUM_LIT:1> ) : <EOL> url = '<STR_LIT>' + manga + '<STR_LIT>' + str ( current_chapter ) + '<STR_LIT>' + str ( page ) + '<STR_LIT>' <EOL> source = getSourceCode ( url ) <EOL> img_url = re . compile ( '<STR_LIT>' ) . search ( source ) . group ( <NUM_LIT:1> ) <EOL> print ( '<STR_LIT>' + str ( current_chapter ) + '<STR_LIT>' + '<STR_LIT>' + str ( page ) ) <EOL> print ( img_url ) <EOL> downloadImage ( img_url , os . path . join ( '<STR_LIT>' , manga_chapter_prefix + '<STR_LIT:_>' + str ( page ) . zfill ( <NUM_LIT:3> ) ) ) <EOL> compress ( manga_chapter_prefix , download_path , max_pages , download_format ) </s>
