I have a number of nexusmods ublock origin filters that look like this:…
- User
I have a number of nexusmods ublock origin filters that look like this:
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 "]
However the site has been redesigned and now those filters are useless. I want to convert them into the relevant images like this (these are not the equivalent to the above games, using them simply as an example):
||staticdelivery.nexusmods.com/images/games/4_3/tile_1190.jpg ||staticdelivery.nexusmods.com/images/games/4_3/tile_120.jpg ||staticdelivery.nexusmods.com/images/games/4_3/tile_1216.jpg ||staticdelivery.nexusmods.com/images/games/4_3/tile_1231.jpg ||staticdelivery.nexusmods.com/images/games/4_3/tile_1234.jpg ||staticdelivery.nexusmods.com/images/games/4_3/tile_1238.jpg ||staticdelivery.nexusmods.com/images/games/4_3/tile_1249.jpg ||staticdelivery.nexusmods.com/images/games/4_3/tile_1271.jpg ||staticdelivery.nexusmods.com/images/games/4_3/tile_1277.jpg
As you can see, this can only be done automatically if 'something' accesses the links of the original filters (I don't know much computer science). How would we be able to do this?
If it's of any help, I have sleuthed with my minimal computer science knowledge and found that in the developer tools the relevant url would look like this:
https://images.nexusmods.com/images/games/4_3/tile_4875.jpg https://images.nexusmods.com/images/games/4_3/tile_1704.jpg https://images.nexusmods.com/images/games/4_3/tile_1719.jpg https://images.nexusmods.com/images/games/4_3/tile_1724.jpg https://images.nexusmods.com/images/games/4_3/tile_1730.jpg
Assistant
Converting NexusMods uBlock Filters to Image Blocking Rules
To convert your existing NexusMods uBlock filters to block the new image URLs, you'll need to:
- Find the mapping between game names and their new image URLs
- Create a script to automate this conversion
Manual Approach (for a few games)
For a small number of games, you can manually:
- Visit each game's page on NexusMods
- Inspect the image URLs in the Network tab of Developer Tools
- Create blocking rules like your example
Automated Approach (for many games)
Here's how to automate this:
Step 1: Create a mapping file
First, create a JSON file that maps game names to their image IDs:
{ "needforspeedheat": "4875", "needforspeedunbound": "1704", "neverwinter2": "1719", "newvegas": "1724", "nioh2": "1730" }Step 2: Create a conversion script
Here's a Python script that converts your old filters to new ones:
import json # Your old filters (example format) old_filters = [ '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 "]' ] # Load the mapping with open('game_mapping.json') as f: game_mapping = json.load(f) # Convert filters new_filters = [] for filter in old_filters: # Extract game name from URL game_name = filter.split('/games/')[1].split('"')[0].lower() if game_name in game_mapping: image_id = game_mapping[game_name] new_filter = f'||staticdelivery.nexusmods.com/images/games/4_3/tile_{image_id}.jpg' new_filters.append(new_filter) # Output the new filters for new_filter in new_filters: print(new_filter)Step 3: Run the script
- Save the mapping to
game_mapping.json - Save the script as
convert_filters.py - Run it with Python:
python convert_filters.py
Alternative: Browser Extension Approach
If you want to automate the process of finding all image URLs:
- Create a browser extension that:
- Visits each game page
- Extracts all image URLs
- Generates blocking rules
- Saves them to a file
This would be more complex but would give you complete coverage.
Notes
- The image IDs in your example seem to be different from the ones in your original filters - you'll need to verify the correct mapping.
- The domain changed from
images.nexusmods.comtostaticdelivery.nexusmods.com- make sure to use the correct one. - You may need to adjust the path structure (
4_3/tile_vs other patterns).
Would you like me to elaborate on any of these approaches or help you find the correct image IDs for your specific games?
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.