@@ -19,30 +19,23 @@ def _download_metalinksdb(verbose=True):
1919 """
2020 requests = _check_if_installed ("requests" )
2121
22- METALINKS_URL = "https://figshare.com/ndownloader/files/60861292"
22+ # GitHub Releases URL (CI-friendly, no WAF issues)
23+ METALINKS_URL = "https://github.com/saezlab/liana-py/releases/download/metalinksdb/metalinksdb.db"
2324
24- # Define the local filename to save the downloaded database
2525 db_file_name = 'metalinksdb.db'
2626 db_path = os .path .join (os .getcwd (), db_file_name )
2727
28- # Check if the database file already exists and is valid
2928 if os .path .exists (db_path ):
30- # Check if file is empty or corrupted
3129 if os .path .getsize (db_path ) == 0 :
3230 _logg ("Existing database file is empty. Removing and re-downloading..." , verbose = verbose )
3331 os .remove (db_path )
3432 else :
3533 return db_path
3634
37- # Download the database
3835 _logg ("Downloading database..." , verbose = verbose )
3936 try :
40- # Figshare requires a browser-like User-Agent to bypass WAF
41- headers = {
42- 'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'
43- }
44- response = requests .get (METALINKS_URL , headers = headers , stream = True , allow_redirects = True )
45- response .raise_for_status () # Raise an error for bad status codes
37+ response = requests .get (METALINKS_URL , stream = True , allow_redirects = True )
38+ response .raise_for_status ()
4639
4740 with open (db_path , 'wb' ) as f :
4841 for chunk in response .iter_content (chunk_size = 8192 ):
0 commit comments