<s> import re <EOL> from parsers . base import SiteParserBase <EOL> from util import getSourceCode <EOL> class MangaPanda ( SiteParserBase ) : <EOL> re_getSeries = re . compile ( '<STR_LIT>' ) <EOL> re_getChapters = re . compile ( '<STR_LIT>' ) <EOL> re_getPage = re . compile ( "<STR_LIT>" ) <EOL> re_getImage = re . compile ( '<STR_LIT>' ) <EOL> re_getMaxPages = re . compile ( '<STR_LIT>' ) <EOL> def parseSite ( self ) : <EOL> print ( '<STR_LIT>' % self . manga ) <EOL> url = '<STR_LIT>' <EOL> source = getSourceCode ( url , self . proxy ) <EOL> allSeries = MangaPanda . re_getSeries . findall ( source [ source . find ( '<STR_LIT>' ) : ] ) <EOL> keyword = self . selectFromResults ( allSeries ) <EOL> url = '<STR_LIT>' % keyword <EOL> source = getSourceCode ( url , self . proxy ) <EOL> self . chapters = MangaPanda . re_getChapters . findall ( source ) <EOL> lowerRange = <NUM_LIT:0> <EOL> for i in range ( <NUM_LIT:0> , len ( self . chapters ) ) : <EOL> self . chapters [ i ] = ( '<STR_LIT>' % self . chapters [ i ] [ <NUM_LIT:0> ] , '<STR_LIT>' % ( self . chapters [ i ] [ <NUM_LIT:1> ] , self . chapters [ i ] [ <NUM_LIT:2> ] ) , self . chapters [ i ] [ <NUM_LIT:1> ] ) <EOL> if ( not self . auto ) : <EOL> print ( '<STR_LIT>' % ( i + <NUM_LIT:1> , self . chapters [ i ] [ <NUM_LIT:1> ] ) ) <EOL> else : <EOL> if ( self . lastDownloaded == self . chapters [ i ] [ <NUM_LIT:1> ] ) : <EOL> lowerRange = i + <NUM_LIT:1> <EOL> upperRange = len ( self . chapters ) <EOL> self . isPrependMangaName = False <EOL> if ( not self . auto ) : <EOL> self . chapters_to_download = self . selectChapters ( self . chapters ) <EOL> else : <EOL> if ( lowerRange == upperRange ) : <EOL> raise self . NoUpdates <EOL> for i in range ( lowerRange , upperRange ) : <EOL> self . chapters_to_download . append ( i ) <EOL> self . isPrependMangaName = True <EOL> return <EOL> def downloadChapter ( self , downloadThread , max_pages , url , manga_chapter_prefix , current_chapter ) : <EOL> pageIndex = <NUM_LIT:0> <EOL> for page in MangaPanda . re_getPage . findall ( getSourceCode ( url , self . proxy ) ) : <EOL> if ( self . verbose_FLAG ) : <EOL> print ( self . chapters [ current_chapter ] [ <NUM_LIT:1> ] + '<STR_LIT>' + '<STR_LIT>' % ( page [ <NUM_LIT:1> ] , max_pages ) ) <EOL> pageUrl = '<STR_LIT>' + page [ <NUM_LIT:0> ] <EOL> self . downloadImage ( downloadThread , page [ <NUM_LIT:1> ] , pageUrl , manga_chapter_prefix ) <EOL> pageIndex = pageIndex + <NUM_LIT:1> </s>
