code: def scan_archive(path):
      
      # check for non-existing path
      if not os.path.exists(path):
          raise ValueError('Path does not exist')
  
      # check video extension
      if not path.endswith(ARCHIVE_EXTENSIONS):
          raise ValueError('%r is not a valid archive extension' % os.path.splitext(path)[1])
  
      dirpath, filename = os.path.split(path)
      logger.info('Scanning archive %r in %r', filename, dirpath)
  
      # rar extension
      if filename.endswith('.rar'):
          rar = RarFile(path)
  
          # filter on video extensions
          rar_filenames = [f for f in rar.namelist() if f.endswith(VIDEO_EXTENSIONS)]
  
          # no video found
          if not rar_filenames:
              raise ValueError('No video in archive')
  
          # more than one video found
          if len(rar_filenames) > 1:
              raise ValueError('More than one video in archive')
  
          # guess
          rar_filename = rar_filenames[0]
          rar_filepath = os.path.join(dirpath, rar_filename)
          video = Video.fromguess(rar_filepath, guessit(rar_filepath))
  
          # size
          video.size = rar.getinfo(rar_filename).file_size
      else:
          raise ValueError('Unsupported extension %r' % os.path.splitext(path)[1])
  
      return video
docs: Scan an archive from a `path`.
  
      :param str path: existing path to the archive.
      :return: the scanned video.
      :rtype: :class:`~subliminal.video.Video`