2020-07-09 22:20:38 +00:00
|
|
|
import shutil
|
|
|
|
|
|
|
|
import git
|
|
|
|
from git.repo.base import Repo
|
|
|
|
from giturlparse import parse
|
|
|
|
|
|
|
|
# class Progress(git.remote.RemoteProgress):
|
|
|
|
# def update(self, op_code, cur_count, max_count=None, message=''):
|
|
|
|
# print(self._cur_line)
|
|
|
|
|
2020-07-09 23:15:08 +00:00
|
|
|
with open("unique_links.txt") as fp:
|
2020-07-09 22:20:38 +00:00
|
|
|
links = fp.readlines()
|
|
|
|
for i, link in enumerate(links, start=1):
|
|
|
|
link = link.rstrip()
|
|
|
|
name = parse(link).name
|
2020-07-09 23:15:08 +00:00
|
|
|
print(f"File num: {i}")
|
2020-07-09 22:20:38 +00:00
|
|
|
Repo.clone_from(link, name)
|
|
|
|
try:
|
2020-07-09 23:15:08 +00:00
|
|
|
shutil.move(name, "reps")
|
2020-07-09 22:20:38 +00:00
|
|
|
except:
|
|
|
|
shutil.rmtree(name)
|