Myrient Api !!hot!! May 2026
def search_files_interactive(api: MyrientAPI): """Interactive file search""" print("\n--- SEARCH FILES ---") query = input("Enter search term: ").strip() if not query: print("Search term cannot be empty") return system = input("Filter by system (optional, press Enter to skip): ").strip() system = system if system else None print(f"\nSearching for '{query}'...") results = api.search_files(query, system) if not results: print("No results found.") return print(f"\nFound {len(results)} results:") print("-" * 80) for i, file in enumerate(results[:20], 1): # Show first 20 results print(f"{i}. Name: {file.get('name', 'N/A')}") print(f" System: {file.get('system', 'N/A')}") print(f" Size: {file.get('size', 'N/A')} bytes") print(f" ID: {file.get('id', 'N/A')}") print("-" * 80)
def main(): """Main program loop""" api = MyrientAPI() print("Myrient API Text Interface") print("Note: This is an unofficial interface") actions = { '1': search_files_interactive, '2': list_systems_interactive, '3': get_file_info_interactive, '4': get_download_link_interactive, } while True: print_menu() choice = input("\nEnter your choice (1-5): ").strip() if choice == '5': print("Goodbye!") break elif choice in actions: actions[choice](api) else: print("Invalid choice. Please try again.") input("\nPress Enter to continue...") myrient api
--- SEARCH FILES --- Enter search term: mario Filter by system (optional, press Enter to skip): nintendo (y/n): ")
def get_download_link_interactive(api: MyrientAPI): """Get download link for a file""" print("\n--- DOWNLOAD LINK ---") file_id = input("Enter file ID: ").strip() if not file_id: print("File ID cannot be empty") return url = api.download_link(file_id) if url: print(f"\nDownload URL: {url}") save = input("\nSave to file? (y/n): ").lower() if save == 'y': filename = input("Enter filename: ").strip() if filename: with open(filename, 'w') as f: f.write(url) print(f"Download link saved to {filename}") else: print("Could not retrieve download link") file in enumerate(results[:20]