1.21.10 - 6/11/25

This commit is contained in:
Yorgei
2025-11-06 14:29:24 +10:00
commit 4496db5a39
5 changed files with 1907 additions and 0 deletions

82
get_info.py Normal file
View File

@@ -0,0 +1,82 @@
import yaml
import requests
import json
import sys
import os
def get_modrinth_projects():
with open('docker-compose.yml', 'r') as f:
compose = yaml.safe_load(f)
projects_str = compose['services']['mc']['environment']['MODRINTH_PROJECTS']
project_ids = [pid.strip() for pid in projects_str.strip().split('\n') if pid.strip()]
return project_ids
def fetch_project_data(project_id):
url = f'https://api.modrinth.com/v2/project/{project_id}'
response = requests.get(url)
response.raise_for_status()
return response.json()
def format_plugin_json(data):
plugin_json = {
"name": data.get('title'),
"description": data.get('description', ''),
"slug": data.get('slug'),
"url": f"https://modrinth.com/plugin/{data.get('slug')}",
"supported_versions": data.get('game_versions', []),
"server_support": data.get('loaders', []),
"updated": data.get('updated', ''),
"source_url": data.get('source_url', ''),
"wiki_url": data.get('wiki_url', ''),
"icon_url": data.get('icon_url', ''),
"body_text": data.get('body', ''),
}
return plugin_json
def fetch_vanillatweaks_info(sharecode):
url = f'https://vanillatweaks.net/assets/server/sharecode.php?code={sharecode}'
response = requests.get(url)
response.raise_for_status()
return response.json()
def get_vanillatweaks_info():
with open('docker-compose.yml', 'r') as f:
compose = yaml.safe_load(f)
sharecode = compose['services']['mc']['environment']['VANILLATWEAKS_SHARECODE']
data = fetch_vanillatweaks_info(sharecode)
return data
def main():
plugins = {}
plugin_minified = {}
vanillatweaks_info = get_vanillatweaks_info()
with open('lists/vanillatweaks.json', 'w', encoding='utf-8') as f:
json.dump(vanillatweaks_info, f, indent=4, ensure_ascii=False)
try:
project_ids = get_modrinth_projects()
for project_id in project_ids:
try:
data = fetch_project_data(project_id)
plugins[project_id] = format_plugin_json(data)
print(f"Fetched {project_id}: {plugins[project_id]['name']} - {plugins[project_id]['description'].replace('\n', ' ')}")
plugin_minified[project_id] = {
"name": plugins[project_id]['name'],
"description": plugins[project_id]['description'].replace('\n', ' '),
"url": plugins[project_id]['url'],
"server_support": plugins[project_id]['server_support']
}
except requests.exceptions.RequestException as e:
print(f"Error fetching {project_id}: {e}", file=sys.stderr)
continue
with open('lists/plugins.json', 'w', encoding='utf-8') as f:
json.dump(plugins, f, indent=4, ensure_ascii=False)
with open('lists/plugins_minified.json', 'w', encoding='utf-8') as f:
json.dump(plugin_minified, f, indent=4, ensure_ascii=False)
except Exception as e:
print(f"Error: {e}", file=sys.stderr)
sys.exit(1)
if __name__ == '__main__':
main()