def download_project()

in download.py [0:0]


def download_project(url, project_path):
    zip_url = url.strip()
    # get only username/projectname, replace / with @
    username_projectname = "/".join(zip_url.strip().split("/")[3:5])
    zipfile_name = username_projectname.replace("/", "@") + ".zip"
    zip_path = os.path.join(project_path, zipfile_name)
    try:
        urllib.request.urlretrieve(zip_url, zip_path)
    except urllib.error.URLError:
        return

    try:
        project_dir = os.path.join(project_path, username_projectname)
        with zipfile.ZipFile(zip_path, "r") as f:
            for file in f.infolist():
                if os.path.splitext(file.filename)[1] == ".java":
                    # copy to a new folder
                    dest_file = "/".join(file.filename.split("/")[1:])
                    dest_path = os.path.join(project_dir, dest_file)
                    dest_dir = "/".join(dest_path.split("/")[:-1])
                    # cannot use shutil here because we're copying bytes to non-bytes
                    content = f.read(file.filename)
                    if not os.path.exists(dest_dir):
                        os.makedirs(dest_dir)
                    with open(dest_path, "wb") as outfile:
                        outfile.write(content)
        os.remove(zip_path)
    except Exception:
        os.remove(zip_path)