def obtainInfo(self):
try:<EOL><INDENT>info = self.ytdl.extract_info(self.yid, download=False)<EOL><DEDENT>except youtube_dl.utils.DownloadError:<EOL><INDENT>raise ConnectionError<EOL><DEDENT>if not self.preferences['<STR_LIT>']:<EOL><INDENT>self.url = (info['<STR_LIT>'][<NUM_LIT:0>]['<STR_LIT:url>'], info['<STR_LIT>'][<NUM_LIT:1>]['<STR_LIT:url>'])<EOL>return True<EOL><DEDENT>for f in info['<STR_LIT>']:<EOL><INDENT>if '<STR_LIT>' not in f or not f['<STR_LIT>']:<EOL><INDENT>f['<STR_LIT>'] = float('<STR_LIT>') <EOL><DEDENT><DEDENT>aud = {(-int(f['<STR_LIT>']),    f['<STR_LIT>'], f['<STR_LIT:url>']) for f in info['<STR_LIT>'] if f.get('<STR_LIT>') and not f.get('<STR_LIT>')}<EOL>vid = {(-int(f['<STR_LIT>']), f['<STR_LIT>'], f['<STR_LIT:url>']) for f in info['<STR_LIT>'] if not f.get('<STR_LIT>') and f.get('<STR_LIT>')}<EOL>full= {(-int(f['<STR_LIT>']), f['<STR_LIT>'], f['<STR_LIT:url>']) for f in info['<STR_LIT>'] if f.get('<STR_LIT>') and f.get('<STR_LIT>')}<EOL>try:<EOL><INDENT>_f = int( self.preferences.get('<STR_LIT>') ) <EOL>_k = lambda x: abs(x[<NUM_LIT:0>] + _f) <EOL><DEDENT>except (ValueError, TypeError):<EOL><INDENT>_k = lambda d: d<EOL><DEDENT>if self.preferences['<STR_LIT>'] and self.preferences['<STR_LIT>']: fm = sorted(full, key=_k)<EOL>elif self.preferences['<STR_LIT>']: fm = sorted(aud, key=_k)<EOL>elif self.preferences['<STR_LIT>']: fm = sorted(vid, key=_k)<EOL>filesize = <NUM_LIT:0><EOL>i = -<NUM_LIT:1><EOL>try:<EOL><INDENT>while filesize == <NUM_LIT:0>: <EOL><INDENT>i += <NUM_LIT:1><EOL>self.url = fm[i][<NUM_LIT:2>]<EOL>if fm[i][<NUM_LIT:1>] == float('<STR_LIT>'):<EOL><INDENT>filesize = int(self.r_session.head(self.url).headers['<STR_LIT>'])<EOL><DEDENT>else:<EOL><INDENT>filesize = int(fm[i][<NUM_LIT:1>])<EOL><DEDENT><DEDENT><DEDENT>except IndexError: <EOL><INDENT>self.url = (info['<STR_LIT>'][<NUM_LIT:0>]['<STR_LIT:url>'], info['<STR_LIT>'][<NUM_LIT:1>]['<STR_LIT:url>'])<EOL>self.preferences['<STR_LIT>'] = False <EOL>return True<EOL><DEDENT>self.filesize = filesize<EOL>return True<EOL>
Method for obtaining information about the movie.