Stop trying to generate sourceforge direct links

This commit is contained in:
Shivam Jha 2020-03-26 16:02:36 +05:30 committed by GitHub
parent be9c64a9aa
commit 6d07c3c8c4
Signed by untrusted user: GitHub
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,8 +36,6 @@ def direct_link_generator(link: str):
return cm_ru(link)
elif 'mediafire.com' in link:
return mediafire(link)
elif 'sourceforge.net' in link:
return sourceforge(link)
elif 'osdn.net' in link:
return osdn(link)
elif 'github.com' in link:
@ -175,23 +173,6 @@ def mediafire(url: str) -> str:
return dl_url
def sourceforge(url: str) -> str:
""" SourceForge direct links generator """
try:
link = re.findall(r'\bhttps?://.*sourceforge\.net\S+', url)[0]
except IndexError:
raise DirectDownloadLinkException("`No SourceForge links found`\n")
file_path = re.findall(r'files(.*)/download', link)[0]
project = re.findall(r'projects?/(.*?)/files', link)[0]
mirrors = f'https://sourceforge.net/settings/mirror_choices?' \
f'projectname={project}&filename={file_path}'
page = BeautifulSoup(requests.get(mirrors).content, 'html.parser')
info = page.find('ul', {'id': 'mirrorList'}).findAll('li')
for mirror in info[1:]:
dl_url = f'https://{mirror["id"]}.dl.sourceforge.net/project/{project}/{file_path}'
return dl_url
def osdn(url: str) -> str:
""" OSDN direct links generator """
osdn_link = 'https://osdn.net'