Скрипт написанный на python который позволяет запросто удалить все свои темы, или темы в определенных разделах 1) Необходимо иметь установленный python (У меня версия 3.11) 2) Создаем пустой файл script.py и открываем его в любом текстовом редакторе 3) Вставляем данный код: import requests import time import sys from collections import defaultdict import re # --- НАСТРОЙКИ --- TOKEN = "ТОКЕНЛОЛЗА" # Сюда вставим токен BASE_URL = "https://prod-api.lolz.live" REQUEST_DELAY = 0.55 # Задержка между запросами def get_all_user_threads_with_forum_info(headers, user_id): all_threads_info = [] page = 1 print("2. Сканирую все ваши темы для сбора информации...") while True: try: params = {"creator_user_id": user_id, "page": page} response = requests.get(f"{BASE_URL}/threads", headers=headers, params=params) response.raise_for_status() data = response.json() threads_on_page = data.get("threads", []) if not threads_on_page: sys.stdout.write('\r' + ' ' * 80 + '\r') # Очистка строки print(f" Сканирование завершено. Всего найдено тем: {len(all_threads_info)}") break for thread in threads_on_page: all_threads_info.append({ "thread_id": thread["thread_id"], "forum_id": thread["forum"]["forum_id"], "forum_title": thread["forum"]["forum_title"] }) status_line = f" Просканировано страниц: {page} | Найдено тем: {len(all_threads_info)}" sys.stdout.write('\r' + status_line) sys.stdout.flush() page += 1 time.sleep(REQUEST_DELAY) except requests.exceptions.RequestException as e: print(f"\n Ошибка при запросе страницы {page}: {e}. Прерываю сбор.") return None except Exception as e: print(f"\n Произошла непредвиденная ошибка на странице {page}: {e}") return None return all_threads_info def extract_unique_forums(threads_info): if not threads_info: return [] unique_forums = {thread['forum_id']: thread['forum_title'] for thread in threads_info} forums_list = [{'forum_id': fid, 'forum_title': title} for fid, title in unique_forums.items()] return sorted(forums_list, key=lambda x: x['forum_title']) def select_forums_to_delete(user_forums, multi_select=False): if not user_forums: return None print("\nВаши темы находятся в следующих разделах:") for i, forum in enumerate(user_forums): print(f" [{i+1}] {forum['forum_title']} (ID: {forum['forum_id']})") prompt = "Введите номера разделов через запятую или пробел (например, 1 5 12): " if multi_select else "Введите номер раздела: " while True: try: choice_str = input(f"\n{prompt}") if not choice_str: print("Ввод не может быть пустым.") continue # Разделяем по запятым, пробелам и другим не-числовым символам parts = re.split(r'[\s,]+', choice_str.strip()) selected_indices = [int(x) - 1 for x in parts if x] chosen_forum_ids = [] valid_choice = True for index in selected_indices: if 0 <= index < len(user_forums): chosen_forum_ids.append(user_forums[index]['forum_id']) else: print(f" Ошибка: номер {index + 1} находится вне допустимого диапазона (от 1 до {len(user_forums)}).") valid_choice = False break if valid_choice: if not multi_select and len(chosen_forum_ids) > 1: print(" Ошибка: в этом режиме можно выбрать только один раздел.") continue return chosen_forum_ids except ValueError: print(" Ошибка: вводите только числа, разделенные запятой или пробелом.") except Exception as e: print(f"Произошла непредвиденная ошибка: {e}") return None def display_menu(): print("\n" + "="*15 + " МЕНЮ " + "="*15) print("Выберите режим удаления:") print(" [1] Удалить ВСЕ мои темы") print(" [2] Удалить темы из ОДНОГО конкретного раздела") print(" [3] Удалить темы из НЕСКОЛЬКИХ разделов") print(" [0] Выход") print("="*36) return input("Ваш выбор: ") def main(): if TOKEN == "ТОКЕНЛОЛЗА" or not TOKEN: print(" ОШИБКА: Пожалуйста, вставьте ваш токен в коде.") return headers = {"accept": "application/json", "authorization": f"Bearer {TOKEN}"} # 1. Получаем ID пользователя try: print("1. Получаю информацию о пользователе...") me_response = requests.get(f"{BASE_URL}/users/me", headers=headers) me_response.raise_for_status() me_data = me_response.json() user_id = me_data["user"]["user_id"] username = me_data["user"]["username"] print(f" Успешно! Ваш ник: {username}, ID: {user_id}") print("-" * 30) except requests.exceptions.RequestException as e: print(f" Сетевая ошибка или неверный токен: {e}") return # 2. ЕДИНОРАЗОВО собираем все темы пользователя all_user_threads = get_all_user_threads_with_forum_info(headers, user_id) if all_user_threads is None: return if not all_user_threads: print("\n У вас нет тем для удаления. Выход.") return # 3. Главный цикл меню while True: choice = display_menu() thread_ids_to_delete = [] if choice == '1': thread_ids_to_delete = [thread['thread_id'] for thread in all_user_threads] elif choice in ['2', '3']: user_forums = extract_unique_forums(all_user_threads) if not user_forums: print("Не найдено разделов, в которых у вас есть темы.") continue if len(user_forums) == 1: print(f"\nУ вас есть темы только в одном разделе: '{user_forums[0]['forum_title']}'. Автоматический выбор.") selected_forum_ids = [user_forums[0]['forum_id']] else: selected_forum_ids = select_forums_to_delete(user_forums, multi_select=(choice == '3')) if selected_forum_ids: thread_ids_to_delete = [ thread['thread_id'] for thread in all_user_threads if thread['forum_id'] in selected_forum_ids ] elif choice == '0': break else: print("Неверный выбор. Пожалуйста, введите число от 0 до 3.") continue if not thread_ids_to_delete: if choice != '0': print("Не выбрано ни одной темы для удаления. Возврат в меню.") continue total_threads = len(thread_ids_to_delete) print(f"\n Всего найдено тем для удаления: {total_threads}") print("-" * 30) # 4. Подтверждение перед удалением try: confirm = input(f" Вы уверены, что хотите удалить {total_threads} тем? Это действие НЕОБРАТИМО. (введите 'да'): ") if confirm.lower() != 'да': print("Отмена операции.") continue except KeyboardInterrupt: print("\nОтмена операции пользователем.") continue print("-" * 30) print(" Начинаю удаление тем...") # 5. Удаление тем deleted_count = 0 failed_count = 0 error_reasons = defaultdict(int) for i, thread_id in enumerate(thread_ids_to_delete): status_line = f"Удалено: {deleted_count} | Осталось: {total_threads - (i + 1)} | Ошибок: {failed_count}" sys.stdout.write('\r' + " " * 80 + '\r') sys.stdout.write(status_line) sys.stdout.flush() try: delete_url = f"{BASE_URL}/threads/{thread_id}" response = requests.delete(delete_url, headers=headers, params={"reason": "Удаление через скрипт"}) if response.status_code >= 400: failed_count += 1 try: reason = response.json().get("errors", ["Неизвестная ошибка API"])[0] error_reasons[reason] += 1 except (ValueError, IndexError): reason = f"HTTP {response.status_code}: {response.reason}" error_reasons[reason] += 1 else: deleted_count += 1 except requests.exceptions.RequestException as e: failed_count += 1 error_reasons[f"Сетевая ошибка: {e}"] += 1 time.sleep(REQUEST_DELAY) # 6. Итоговый результат print("\n" + "-" * 30) print(" Операция завершена!") print("\n--- ИТОГОВЫЙ РЕЗУЛЬТАТ ---") print(f" Удалено успешно: {deleted_count} тем") print(f" Не удалось удалить: {failed_count} тем") if failed_count > 0: print("\nПричины ошибок:") for reason, count in error_reasons.items(): print(f" - \"{reason}\": {count} раз") if __name__ == "__main__": main() input("\nНажмите Enter для выхода...") Python import requests import time import sys from collections import defaultdict import re # --- НАСТРОЙКИ --- TOKEN = "ТОКЕНЛОЛЗА" # Сюда вставим токен BASE_URL = "https://prod-api.lolz.live" REQUEST_DELAY = 0.55 # Задержка между запросами def get_all_user_threads_with_forum_info(headers, user_id): all_threads_info = [] page = 1 print("2. Сканирую все ваши темы для сбора информации...") while True: try: params = {"creator_user_id": user_id, "page": page} response = requests.get(f"{BASE_URL}/threads", headers=headers, params=params) response.raise_for_status() data = response.json() threads_on_page = data.get("threads", []) if not threads_on_page: sys.stdout.write('\r' + ' ' * 80 + '\r') # Очистка строки print(f" Сканирование завершено. Всего найдено тем: {len(all_threads_info)}") break for thread in threads_on_page: all_threads_info.append({ "thread_id": thread["thread_id"], "forum_id": thread["forum"]["forum_id"], "forum_title": thread["forum"]["forum_title"] }) status_line = f" Просканировано страниц: {page} | Найдено тем: {len(all_threads_info)}" sys.stdout.write('\r' + status_line) sys.stdout.flush() page += 1 time.sleep(REQUEST_DELAY) except requests.exceptions.RequestException as e: print(f"\n Ошибка при запросе страницы {page}: {e}. Прерываю сбор.") return None except Exception as e: print(f"\n Произошла непредвиденная ошибка на странице {page}: {e}") return None return all_threads_info def extract_unique_forums(threads_info): if not threads_info: return [] unique_forums = {thread['forum_id']: thread['forum_title'] for thread in threads_info} forums_list = [{'forum_id': fid, 'forum_title': title} for fid, title in unique_forums.items()] return sorted(forums_list, key=lambda x: x['forum_title']) def select_forums_to_delete(user_forums, multi_select=False): if not user_forums: return None print("\nВаши темы находятся в следующих разделах:") for i, forum in enumerate(user_forums): print(f" [{i+1}] {forum['forum_title']} (ID: {forum['forum_id']})") prompt = "Введите номера разделов через запятую или пробел (например, 1 5 12): " if multi_select else "Введите номер раздела: " while True: try: choice_str = input(f"\n{prompt}") if not choice_str: print("Ввод не может быть пустым.") continue # Разделяем по запятым, пробелам и другим не-числовым символам parts = re.split(r'[\s,]+', choice_str.strip()) selected_indices = [int(x) - 1 for x in parts if x] chosen_forum_ids = [] valid_choice = True for index in selected_indices: if 0 <= index < len(user_forums): chosen_forum_ids.append(user_forums[index]['forum_id']) else: print(f" Ошибка: номер {index + 1} находится вне допустимого диапазона (от 1 до {len(user_forums)}).") valid_choice = False break if valid_choice: if not multi_select and len(chosen_forum_ids) > 1: print(" Ошибка: в этом режиме можно выбрать только один раздел.") continue return chosen_forum_ids except ValueError: print(" Ошибка: вводите только числа, разделенные запятой или пробелом.") except Exception as e: print(f"Произошла непредвиденная ошибка: {e}") return None def display_menu(): print("\n" + "="*15 + " МЕНЮ " + "="*15) print("Выберите режим удаления:") print(" [1] Удалить ВСЕ мои темы") print(" [2] Удалить темы из ОДНОГО конкретного раздела") print(" [3] Удалить темы из НЕСКОЛЬКИХ разделов") print(" [0] Выход") print("="*36) return input("Ваш выбор: ") def main(): if TOKEN == "ТОКЕНЛОЛЗА" or not TOKEN: print(" ОШИБКА: Пожалуйста, вставьте ваш токен в коде.") return headers = {"accept": "application/json", "authorization": f"Bearer {TOKEN}"} # 1. Получаем ID пользователя try: print("1. Получаю информацию о пользователе...") me_response = requests.get(f"{BASE_URL}/users/me", headers=headers) me_response.raise_for_status() me_data = me_response.json() user_id = me_data["user"]["user_id"] username = me_data["user"]["username"] print(f" Успешно! Ваш ник: {username}, ID: {user_id}") print("-" * 30) except requests.exceptions.RequestException as e: print(f" Сетевая ошибка или неверный токен: {e}") return # 2. ЕДИНОРАЗОВО собираем все темы пользователя all_user_threads = get_all_user_threads_with_forum_info(headers, user_id) if all_user_threads is None: return if not all_user_threads: print("\n У вас нет тем для удаления. Выход.") return # 3. Главный цикл меню while True: choice = display_menu() thread_ids_to_delete = [] if choice == '1': thread_ids_to_delete = [thread['thread_id'] for thread in all_user_threads] elif choice in ['2', '3']: user_forums = extract_unique_forums(all_user_threads) if not user_forums: print("Не найдено разделов, в которых у вас есть темы.") continue if len(user_forums) == 1: print(f"\nУ вас есть темы только в одном разделе: '{user_forums[0]['forum_title']}'. Автоматический выбор.") selected_forum_ids = [user_forums[0]['forum_id']] else: selected_forum_ids = select_forums_to_delete(user_forums, multi_select=(choice == '3')) if selected_forum_ids: thread_ids_to_delete = [ thread['thread_id'] for thread in all_user_threads if thread['forum_id'] in selected_forum_ids ] elif choice == '0': break else: print("Неверный выбор. Пожалуйста, введите число от 0 до 3.") continue if not thread_ids_to_delete: if choice != '0': print("Не выбрано ни одной темы для удаления. Возврат в меню.") continue total_threads = len(thread_ids_to_delete) print(f"\n Всего найдено тем для удаления: {total_threads}") print("-" * 30) # 4. Подтверждение перед удалением try: confirm = input(f" Вы уверены, что хотите удалить {total_threads} тем? Это действие НЕОБРАТИМО. (введите 'да'): ") if confirm.lower() != 'да': print("Отмена операции.") continue except KeyboardInterrupt: print("\nОтмена операции пользователем.") continue print("-" * 30) print(" Начинаю удаление тем...") # 5. Удаление тем deleted_count = 0 failed_count = 0 error_reasons = defaultdict(int) for i, thread_id in enumerate(thread_ids_to_delete): status_line = f"Удалено: {deleted_count} | Осталось: {total_threads - (i + 1)} | Ошибок: {failed_count}" sys.stdout.write('\r' + " " * 80 + '\r') sys.stdout.write(status_line) sys.stdout.flush() try: delete_url = f"{BASE_URL}/threads/{thread_id}" response = requests.delete(delete_url, headers=headers, params={"reason": "Удаление через скрипт"}) if response.status_code >= 400: failed_count += 1 try: reason = response.json().get("errors", ["Неизвестная ошибка API"])[0] error_reasons[reason] += 1 except (ValueError, IndexError): reason = f"HTTP {response.status_code}: {response.reason}" error_reasons[reason] += 1 else: deleted_count += 1 except requests.exceptions.RequestException as e: failed_count += 1 error_reasons[f"Сетевая ошибка: {e}"] += 1 time.sleep(REQUEST_DELAY) # 6. Итоговый результат print("\n" + "-" * 30) print(" Операция завершена!") print("\n--- ИТОГОВЫЙ РЕЗУЛЬТАТ ---") print(f" Удалено успешно: {deleted_count} тем") print(f" Не удалось удалить: {failed_count} тем") if failed_count > 0: print("\nПричины ошибок:") for reason, count in error_reasons.items(): print(f" - \"{reason}\": {count} раз") if __name__ == "__main__": main() input("\nНажмите Enter для выхода...") 4) Получаем токен API на https://lolz.live/account/api (Не забудь скопировать) 5) Вставляем скопированный токен в скрипт TOKEN = "ТОКЕНЛОЛЗА" 6) Сохраняем 7) Запускаем (python script.py) Пример работы:
чутка дополню, недавно меняли домен апишки и старая prod.api не работает, поменяйте ее на https://api.lolz.live
Скрипт хороший, еще можно было бы добавить фильтрацию, например удаление тем в которых меньше определенного количества симпатий/лайков и т.д
B4N, В будущем если лень не будет попробую добавить фильтрацию по разделам, удалить все темы из определенного раздела (можно будет оффтопик чистить) Ну и твою идею тоже по сути реализовать можно