<s> import urlparse <EOL> class Container : <EOL> def __init__ ( self ) : <EOL> self . hasData = False <EOL> self . title = None <EOL> self . author = None <EOL> def scrape ( url , bs ) : <EOL> container = Container ( ) <EOL> domain = urlparse . urlsplit ( url ) [ <NUM_LIT:1> ] . split ( '<STR_LIT::>' ) [ <NUM_LIT:0> ] <EOL> if domain == "<STR_LIT>" : <EOL> headline = bs . find ( "<STR_LIT>" , { "<STR_LIT>" : "<STR_LIT>" } ) <EOL> if headline is not None : <EOL> title = headline . find ( "<STR_LIT>" ) <EOL> if title is not None : <EOL> container . title = title . get_text ( ) . encode ( '<STR_LIT:ascii>' , '<STR_LIT:ignore>' ) <EOL> byline = bs . find ( "<STR_LIT>" , { "<STR_LIT:class>" : "<STR_LIT>" } ) <EOL> if byline is not None : <EOL> author = byline . find ( "<STR_LIT>" , { "<STR_LIT>" : "<STR_LIT:name>" } ) <EOL> if author is not None : <EOL> container . author = author . get_text ( ) . encode ( '<STR_LIT:ascii>' , '<STR_LIT:ignore>' ) <EOL> return container <EOL> return Container ( ) </s>
