This is a great question that perfectly illustrates how a little bit of "computer science" (in this case, web scraping/API interaction) can solve a practical problem!
You're right, the key is to access the information that links the game slug (like needforspeedheat) to its numerical ID (like 4875). Fortunately, Nexus Mods has a public API that makes this much easier and more reliable than trying to "scrape" the new website layout directly.
Here's how we can do it using a Python script:
The Strategy:
- Get Your Nexus Mods API Key: You'll need an API key to access their data programmatically.
- Extract Game Slugs: From your old UBlock Origin filters, we'll extract just the game slugs (e.g.,
needforspeedheat).
- Query the Nexus Mods API: For each game slug, we'll make a request to the Nexus Mods API to get the game's official ID.
- Construct New Filters: Once we have the game ID, we'll format it into the new UBlock Origin filter syntax for the image.
Step-by-Step Guide
1. Get Your Nexus Mods API Key
- Go to the Nexus Mods website and log in.
- Navigate to your account settings.
- Look for a section like "API Key" or "API Access" (usually under "Security" or "Connected Accounts").
- Generate a new API key. Keep this key private! Do not share it publicly.
2. Prepare Your Old Filters
Copy all your old Nexus Mods UBlock Origin filters into a plain text file. For example, if your filters are:
www.nexusmods.com##[href="https://www.nexusmods.com/games/needforspeedheat "]
www.nexusmods.com##[href="https://www.nexusmods.com/games/needforspeedunbound "]
www.nexusmods.com##[href="https://www.nexusmods.com/games/neverwinter2 "]
www.nexusmods.com##[href="https://www.nexusmods.com/games/newvegas "]
www.nexusmods.com##[href="https://www.nexusmods.com/games/nioh2 "]
Just copy and paste them as is.
3. Run the Python Script
You'll need Python installed on your computer. If you don't have it, download it from python.org. During installation, make sure to check "Add Python to PATH."
You'll also need the requests library for Python. Open your command prompt or terminal and run:
pip install requests
Now, create a new file named convert_nexus_filters.py (or any name) and paste the following code into it: