Skip to content

Instantly share code, notes, and snippets.

@alyti
Last active April 3, 2024 20:44
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save alyti/24459f6e2d5eba2cab10aca27d29470b to your computer and use it in GitHub Desktop.
Save alyti/24459f6e2d5eba2cab10aca27d29470b to your computer and use it in GitHub Desktop.
Download mods from ageofempires.com

AoE2 DE Mod downloader bookmarklet

TL;DR:

  1. Make a new bookmark
    • Copy the contents of the snippet below into location field for a new bookmark.
    • Call bookmark whatever you want, I went with AoE2 DE Mod DL.
  2. Make sure you are signed into the website (https://ageofempires.com/mods), if you aren't, the API will just reject your request.
    • It's completely free and doesn't care if you own the game on that account.
  3. Navigate to mod of your choice and click the bookmark.
  4. Wait for a bit, the API tends to be slow...
  5. You should get a download popup for mod's archive.
  6. Extract archive into something like C:\Users\YOUR USERNAME\Games\Age of Empires 2 DE\SOME NUMBERS\mods\local
    • For example I want x256 techs mod (mod id: 832), I would extract contents of the newly downloaded aoe_832.zip into folder C:\Users\alyti\Games\Age of Empires 2 DE\1212112121212121212\mods\local\aoe_832.
javascript:(function() {
let id = parseInt(location.pathname.match("([0-9]{1,5})")[0], 10); if (id === NaN) {return};
fetch("https://api.ageofempires.com/api/v1/mods/Download", {"credentials": "include", "headers": { "Content-Type": "application/json" }, "body": JSON.stringify({id, boolValue: true}), "method": "POST", "mode": "cors"}).then(r => r.json()).then(r => {location.href = r.value.downloadUrl}).catch(e => console.log(e));
})()
@Qattos
Copy link

Qattos commented Feb 7, 2021

Hello, I'm not sure if this is still being maintained but I'll go ahead and report that it's not working for me.
I'm on latest Mozilla browser and I disabled all my plugins in case they're interfering, this is what I get on the web console when I click this bookmark:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://mods.ageofempires.com/api/v1/mods/Download. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://mods.ageofempires.com/api/v1/mods/Download. (Reason: CORS request did not succeed).
TypeError: NetworkError when attempting to fetch resource.

Thanks in advance.

Copy link

ghost commented Jul 27, 2021

doesn't work

@alyti
Copy link
Author

alyti commented Jul 27, 2021

Hey @LuckOrLag & @Qattos,

I've fixed the bookmarklet, breaking was caused by AoE devs changing domain to api.ageofempires.com,
However I have no plans to maintain this going forward, as such if there's any future breaking changes feel free to fork it yourself.

@Qattos
Copy link

Qattos commented Jul 27, 2021

Thank you so much @alyti.

@TutorFx
Copy link

TutorFx commented Jun 15, 2022

Thank you!

@vasT47
Copy link

vasT47 commented Sep 22, 2022

Thank You !

@Carmine8
Copy link

Carmine8 commented Jan 5, 2023

Hi, I managed to get the bookmark to work and downloaded a few mods. It seems like there is no folder with "some numbers" in the game folder so I am not sure where to unzip the mod folder. Can you help? Thank you

@Kavin346
Copy link

Hi @alyti , Thank You so much for this bookmark.
But recently some mods are not getting downloaded. It looks like the recent mods URLs are having 6 digits at the end.
https://www.ageofempires.com/mods/details/124423/

The older mods had 5 digits and the above Bookmark worked.
I see the Regular Expression is set to {1,5}
parseInt(location.pathname.match("([0-9]{1,5})")[0], 10)

When I changed it to {1,6}, I am able to download the mods, But for some reason, AOE2 crashes when I launch the mods.

Please let know if you can help with this. If I am able t fix it, I will fork it. Thanks in advance!

@CesarVerissimo
Copy link

Anyone knows if this still works by using Kavin346 change?

@alex-taxiera
Copy link

I didn't bother with the regex or the method outlined in the OP. Instead I used the website, subscribed to all the mods I wanted. Then from the "subscribed mods" page I opened the console and created a small method just to download the mod:

const fn = (id) => fetch("https://api.ageofempires.com/api/v1/mods/Download", {"credentials": "include", "headers": { "Content-Type": "application/json" }, "body": JSON.stringify({id, boolValue: true}), "method": "POST", "mode": "cors"}).then(r => r.json()).then(r => {location.href = r.value.downloadUrl}).catch(e => console.log(e));

This is a thin wrapper around the fetch call from OP. Basically I just manually entered the IDs from the mods since they were all accessible on the subscribed page. So I entered the above in the console, pressed enter, then did something like this for each mod I wanted: fn(12345) where 12345 is the ID of the mod you want.

@bhattibabu
Copy link

hey can you guys update this cant download new mods
and i am unable to understand the contents in zip files r unable to be understood which folder to put in location

@SamShoking
Copy link

I didn't bother with the regex or the method outlined in the OP. Instead I used the website, subscribed to all the mods I wanted. Then from the "subscribed mods" page I opened the console and created a small method just to download the mod:

const fn = (id) => fetch("https://api.ageofempires.com/api/v1/mods/Download", {"credentials": "include", "headers": { "Content-Type": "application/json" }, "body": JSON.stringify({id, boolValue: true}), "method": "POST", "mode": "cors"}).then(r => r.json()).then(r => {location.href = r.value.downloadUrl}).catch(e => console.log(e));

This is a thin wrapper around the fetch call from OP. Basically I just manually entered the IDs from the mods since they were all accessible on the subscribed page. So I entered the above in the console, pressed enter, then did something like this for each mod I wanted: fn(12345) where 12345 is the ID of the mod you want.

Tnx. This method is working.

@Amspec
Copy link

Amspec commented Apr 3, 2024

I didn't bother with the regex or the method outlined in the OP. Instead I used the website, subscribed to all the mods I wanted. Then from the "subscribed mods" page I opened the console and created a small method just to download the mod:

const fn = (id) => fetch("https://api.ageofempires.com/api/v1/mods/Download", {"credentials": "include", "headers": { "Content-Type": "application/json" }, "body": JSON.stringify({id, boolValue: true}), "method": "POST", "mode": "cors"}).then(r => r.json()).then(r => {location.href = r.value.downloadUrl}).catch(e => console.log(e));

This is a thin wrapper around the fetch call from OP. Basically I just manually entered the IDs from the mods since they were all accessible on the subscribed page. So I entered the above in the console, pressed enter, then did something like this for each mod I wanted: fn(12345) where 12345 is the ID of the mod you want.

Tnx. This method is working.

Brother, I have been trying for an hour. What am i doing wrong.
image_2024-04-04_005119671

@alex-taxiera
Copy link

I didn't bother with the regex or the method outlined in the OP. Instead I used the website, subscribed to all the mods I wanted. Then from the "subscribed mods" page I opened the console and created a small method just to download the mod:

const fn = (id) => fetch("https://api.ageofempires.com/api/v1/mods/Download", {"credentials": "include", "headers": { "Content-Type": "application/json" }, "body": JSON.stringify({id, boolValue: true}), "method": "POST", "mode": "cors"}).then(r => r.json()).then(r => {location.href = r.value.downloadUrl}).catch(e => console.log(e));

This is a thin wrapper around the fetch call from OP. Basically I just manually entered the IDs from the mods since they were all accessible on the subscribed page. So I entered the above in the console, pressed enter, then did something like this for each mod I wanted: fn(12345) where 12345 is the ID of the mod you want.

Tnx. This method is working.

Brother, I have been trying for an hour. What am i doing wrong. image_2024-04-04_005119671

You didn't follow the instructions very well.

So I entered the above in the console, pressed enter, then did something like this for each mod I wanted: fn(12345) where 12345 is the ID of the mod you want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment