def download(self):
    print(('Start downloading %s' % self.origin_url))
    normalize_url = self.parseUrlProtrol(self.origin_url)
    print(('Parse real url %s' % normalize_url))
    title = self.getTitle(normalize_url)
    dest_file = title
    if self.dest_path:
        if (not os.path.exists(self.dest_path)):
            os.makedirs(self.dest_path)
        dest_file = os.path.join(self.dest_path, title)
    if os.path.exists(dest_file):
        os.remove(dest_file)
    bt_type = self.detectProtrolType(normalize_url)
    if (bt_type in [PROTROL_TYEP.HTTP]):
        self._download_http(normalize_url, dest_file)
    elif (bt_type in [PROTROL_TYEP.FTP]):
        self._download_ftp(normalize_url, dest_file)
    else:
        raise Exception('Unknown protrol type detected !')
    print(('\nSaved file: %s' % dest_file))
    return
def download(self):
    print(('Start downloading %s' % self.origin_url))
    normalize_url = self.parseUrlProtrol(self.origin_url)
    print(('Parse real url %s' % normalize_url))
    title = self.getTitle(normalize_url)
    dest_file = title
    if self.dest_path:
        if (not os.path.exists(self.dest_path)):
            os.makedirs(self.dest_path)
        dest_file = os.path.join(self.dest_path, title)
    if os.path.exists(dest_file):
        os.remove(dest_file)
    bt_type = self.detectProtrolType(normalize_url)
    if (bt_type in [PROTROL_TYEP.HTTP]):
        self._download_http(normalize_url, dest_file)
    elif (bt_type in [PROTROL_TYEP.FTP]):
        self._download_ftp(normalize_url, dest_file)
    else:
        raise Exception('Unknown protrol type detected !')
    print(('\nSaved file: %s' % dest_file))
    return