code: def download_links(self, dir_path):
      
      links = self.links
      if not path.exists(dir_path):
        makedirs(dir_path)
      for i, url in enumerate(links):
        if 'start' in self.cseargs:
          i += int(self.cseargs['start'])
        ext = self.cseargs['fileType']
        ext = '.html' if ext == '' else '.' + ext
        file_name = self.cseargs['q'].replace(' ', '_') + '_' + str(i) + ext
        file_path = path.join(dir_path, file_name)
        r = requests.get(url, stream=True)
        if r.status_code == 200:
          with open(file_path, 'wb') as f:
            r.raw.decode_content = True
            shutil.copyfileobj(r.raw, f)
docs: Download web pages or images from search result links.
      
      Args:
        dir_path (str):
          Path of directory to save downloads of :class:`api.results`.links