parsiad / nexus-autodl

Nexus AutoDL is an autoclicker (a.k.a., autodownloader, bot) that helps automate downloading mods from Nexus Mods
https://parsiad.ca/nexus-autodl
MIT License
179 stars 23 forks source link

Found a faster way to download mods from wabbajack #17

Closed Abggithub123 closed 3 months ago

Abggithub123 commented 1 year ago

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:imageypMQWrJ 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

imagehttpsibb-cosqp-Cv-JJ

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
that means if the modlist has 500 mods, the extracted data should be 500 of the download links in the format above. Now I'm requesting for a code if its possible that would just to automatically open up all these links in a browser. The reason is Wabbajack cannot have extension installed in their built in browser(edge webview2) and I could lets say download half of the links with my static internet IP address on 1st instance of chrome and use an vpn extension like urbanvpn on 2nd instance of chrome to download other half download links bypassing nexusmods download limit all without the 5 second wait thanks to this userscript: https://greasyfork.org/en/scripts/394039-nexus-no-wait. After downloading all the mods, opening wabbajack would be just to verify and finish installation without much hassle :D really love ur autoDL but with these methods, downloading would be several times faster! edit: or you could just implement a code in the current autoDL that injects the 5 seconds skip userscript into WJ if its possible
npe607 commented 1 year 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')
schuler-ph commented 1 year ago

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
M1n-74316D65 commented 1 year ago

I have made a tutorial repo.