<s> from ScriptingBridge import * <EOL> from Extractor import * <EOL> import urlparse <EOL> from Utilities import * <EOL> class ComGoogleChrome ( Extractor ) : <EOL> def __init__ ( self ) : <EOL> super ( ComGoogleChrome , self ) . __init__ ( ) <EOL> self . chrome = SBApplication . applicationWithBundleIdentifier_ ( "<STR_LIT>" ) <EOL> def clues ( self ) : <EOL> clues = [ ] <EOL> if not self . chrome . windows ( ) . count ( ) : return <EOL> tab = self . chrome . windows ( ) [ <NUM_LIT:0> ] . activeTab ( ) <EOL> if hasattr ( tab , "<STR_LIT>" ) : <EOL> if not tab . exists ( ) : return <EOL> self . clues_from_url ( tab . URL ( ) ) <EOL> if self . done : <EOL> return <EOL> if hasattr ( tab , "<STR_LIT:source>" ) and tab . source ( ) : <EOL> self . clues_from_html ( tab . source ( ) , tab . URL ( ) ) <EOL> if self . done : return <EOL> relme = RelMeParser ( ) <EOL> try : <EOL> relme . feed ( tab . source ( ) ) <EOL> except Exception : <EOL> return <EOL> print_info ( "<STR_LIT>" % ( "<STR_LIT:U+002C>" . join ( relme . hrefs ) ) ) <EOL> for link in relme . hrefs : <EOL> profile = urlparse . urljoin ( tab . URL ( ) , link ) <EOL> self . clues_from_url ( profile ) <EOL> def tree_to_dict ( tree ) : <EOL> pass <EOL> from sgmllib import SGMLParser <EOL> class RelMeParser ( SGMLParser ) : <EOL> def reset ( self ) : <EOL> SGMLParser . reset ( self ) <EOL> self . hrefs = [ ] <EOL> def do_a ( self , attrs ) : <EOL> if not ( '<STR_LIT>' , '<STR_LIT>' ) in attrs : return <EOL> self . hrefs += filter ( lambda l : re . match ( r'<STR_LIT:http>' , l ) , [ e [ <NUM_LIT:1> ] for e in attrs if e [ <NUM_LIT:0> ] == '<STR_LIT>' ] ) </s>
