Steam Based ID Finiding, Version Control, Storage
All checks were successful
Build and Upload Release (Windows EXE) / Build Windows EXE (release) Successful in 2m32s
All checks were successful
Build and Upload Release (Windows EXE) / Build Windows EXE (release) Successful in 2m32s
This commit is contained in:
@@ -136,6 +136,45 @@ def extract_required_item_ids(url: str) -> List[str]:
|
||||
return sorted(found_ids, key=int)
|
||||
|
||||
|
||||
def extract_required_item_ids_for_id(pub_id: str) -> List[str]:
|
||||
"""Fetch required items for a specific Workshop item ID, including itself."""
|
||||
page_url = f"https://steamcommunity.com/sharedfiles/filedetails/?id={pub_id}"
|
||||
html = fetch_page(page_url)
|
||||
found_ids = extract_required_item_ids_from_html(html)
|
||||
if pub_id:
|
||||
found_ids.add(pub_id)
|
||||
return sorted(found_ids, key=int)
|
||||
|
||||
|
||||
def expand_required_ids_recursive(initial_ids: List[str], max_pages: int = 200) -> List[str]:
|
||||
"""Expand a set of Workshop IDs by following 'Required items' recursively.
|
||||
|
||||
- Starts from initial_ids
|
||||
- For each id, fetches its page and collects its required items
|
||||
- Continues breadth-first until no new IDs are found or max_pages is reached
|
||||
"""
|
||||
queue: List[str] = [i for i in initial_ids if i and i.isdigit()]
|
||||
visited: Set[str] = set()
|
||||
all_ids: Set[str] = set(queue)
|
||||
|
||||
while queue and len(visited) < max_pages:
|
||||
current = queue.pop(0)
|
||||
if current in visited:
|
||||
continue
|
||||
visited.add(current)
|
||||
try:
|
||||
deps = extract_required_item_ids_for_id(current)
|
||||
except Exception:
|
||||
deps = [current]
|
||||
for dep in deps:
|
||||
if dep not in all_ids:
|
||||
all_ids.add(dep)
|
||||
if dep not in visited:
|
||||
queue.append(dep)
|
||||
|
||||
return sorted(all_ids, key=int)
|
||||
|
||||
|
||||
def resolve_workshop_names(ids: List[str], timeout: int = 20) -> Dict[str, str]:
|
||||
"""Resolve Workshop IDs to human-readable titles using Steam API, with HTML fallback.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user