#NEWLINE# def scrape( self , url ) : #NEWLINE# #INDENT# 'Scrapes a url by passing it through youtube-dl' #NEWLINE# if ( not is_youtube ( url ) ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# output = subprocess . check_output ( [ 'youtube-dl' , '-j' , url ] , stderr = subprocess . STDOUT ) #NEWLINE# #UNINDENT# except subprocess . CalledProcessError as cpe : #NEWLINE# #INDENT# raise ScraperError ( 'youtube-dl said "{0}".' . format ( cpe . output ) ) #NEWLINE# #UNINDENT# except OSError : #NEWLINE# #INDENT# raise ScraperError ( 'youtube-dl not installed or not on PATH.' ) #NEWLINE# #UNINDENT# items = [ ] #NEWLINE# for line in output . splitlines ( ) : #NEWLINE# #INDENT# items . append ( json . loads ( line ) ) #NEWLINE# #UNINDENT# items = [ self . transform_item ( item ) for item in self ] #NEWLINE# return items