#NEWLINE# def parse_wallpaper( self , response ) : #NEWLINE# #INDENT# wallpaper = Wallpaper ( ) #NEWLINE# wallpaper [ 'uploader' ] = response . xpath ( '//a[contains(@class, "user-link")]/text()' ) . extract ( ) [ 0 ] #NEWLINE# wallpaper [ 'site' ] = 'wallbase.cc' #NEWLINE# wallpaper [ 'origin' ] = response . url #NEWLINE# wallpaper [ 'favorites' ] = int ( response . xpath ( '//div[contains(@class, "favsrow")]/div[contains(@class, "title")]/span/text()' ) . extract ( ) [ 0 ] ) #NEWLINE# wallpaper [ 'views' ] = int ( '' . join ( response . xpath ( '//div[contains(@class, "centr")]/div[contains(@class, "l1")]//span[contains(@class, "highl")]/text()' ) . extract ( ) [ 0 ] . split ( ',' ) ) ) #NEWLINE# wallpaper [ 'download_link' ] = response . xpath ( '//div[contains(@class, "content")]/img[contains(@class, "wall")]/@src' ) . extract ( ) [ 0 ] #NEWLINE# colors = response . xpath ( '//div[contains(@class, "palette")]/a/@style' ) . extract ( ) #NEWLINE# wallpaper [ 'filetype' ] = wallpaper [ 'download_link' ] . split ( '.' ) [ ( - 1 ) ] #NEWLINE# wallpaper [ 'colors' ] = [ ( '#' + hex [ 0 : ( - 1 ) ] ) for ( n , hex ) in [ color . split ( '#' ) for color in colors ] ] #NEWLINE# res = response . xpath ( '//a[contains(@class, "reso")]/div[contains(@class, "l1")]/text()' ) . extract ( ) [ 0 ] #NEWLINE# wallpaper [ 'x_resolution' ] = int ( res . split ( 'x' ) [ 0 ] ) #NEWLINE# wallpaper [ 'y_resolution' ] = int ( res . split ( 'x' ) [ 1 ] ) #NEWLINE# wallpaper [ 'descriptors' ] = response . xpath ( '//ul[contains(@class, "taglist")]/li[contains(@class, "item")]/a/text()' ) . extract ( ) #NEWLINE# wallpaper [ 'comments' ] = [ '' ] #NEWLINE# ( yield wallpaper )