Closed Abggithub123 closed 3 months ago
Courtesy of chatgpt
import json
# Read the JSON file
with open('modlist', 'r') as file:
json_data = file.read()
# Parse the JSON data
try:
data = json.loads(json_data)
except json.JSONDecodeError as e:
print(f"Error: Failed to decode JSON - {str(e)}")
exit()
# Create a list to store the generated URLs
urls = []
# Process each entry and create URLs
entries = data["Archives"]
for entry in entries:
print(entry)
try:
mod_id = entry['State']['ModID']
file_id = entry['State']['FileID']
url = f"https://www.nexusmods.com/skyrimspecialedition/mods/{mod_id}?tab=files&file_id={file_id}"
urls.append(url)
print(url)
except TypeError:
print("Error: Invalid entry format - skipping entry")
except KeyError:
print("Error: Missing required keys in entry - skipping entry")
# Write the URLs to an output file
with open('output.txt', 'w') as file:
for url in urls:
file.write(url + '\n')
Also courtesy of ChatGPT. This opens 20 of the download links at a time. Let them finish downloading and press enter in the terminal for the next 20.
import webbrowser
# Read the links from the text file
with open('output.txt', 'r') as file:
links = [line.strip() for line in file.readlines()]
# Open links in batches of 20
batch_size = 20
current_batch = 0
total_links = len(links)
while current_batch < total_links:
# Determine the range of links to open in this batch
start_index = current_batch
end_index = min(current_batch + batch_size, total_links)
batch_links = links[start_index:end_index]
# Open each link in the batch
for link in batch_links:
webbrowser.open(link)
# Wait for keyboard input before opening the next batch
input("Press Enter to continue to the next batch...")
# Move to the next batch
current_batch += batch_size
I have made a tutorial repo.
Hello Im not good in english nor do i have a good knowledge in coding so sorry if my explanation/request is hard to understand but I'll try my best. The software has wabbajack files for each modlist. There is 'modlist' file inside this wabbajack file that can be extracted using zip extractor like 7z. img: This file contains thousands of lines of texts containing every mod with its details, modID and fileID. I was thinking of a code that could extract each modID and fileID found in the 'modlist' file with some kind of wildcard pattern and turn it into download link and remove all other unnecessary string/characters so it would be only: https ://www.nexusmods.com/skyrimspecialedition/mods/[modID]?tab=files&file_id=[fileID] . So for wildlander modlist, some of the lines in the modlist file like below
can be turned to <!DOCTYPE html>
Spoiler
https://www.nexusmods.com/skyrimspecialedition/mods/17925?tab=files&file_id=177264 https://www.nexusmods.com/skyrimspecialedition/mods/43097?tab=files&file_id=204112 https://www.nexusmods.com/skyrimspecialedition/mods/13366?tab=files&file_id=114102