threads-cleaner 0.2.2__tar.gz → 0.2.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: threads-cleaner
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: Bulk-delete your Threads posts and replies. Free, open-source, runs locally.
5
5
  Project-URL: Homepage, https://github.com/vincentmathis/threads-cleaner
6
6
  Project-URL: Repository, https://github.com/vincentmathis/threads-cleaner
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "threads-cleaner"
7
- version = "0.2.2"
7
+ version = "0.2.3"
8
8
  description = "Bulk-delete your Threads posts and replies. Free, open-source, runs locally."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -77,7 +77,10 @@ class BrowserDeleter:
77
77
  time.sleep(0.3)
78
78
  except: pass
79
79
  try:
80
- self._page.evaluate("document.querySelectorAll('[role=dialog]').forEach(e=>e.remove()); document.body.style.overflow='';")
80
+ self._page.keyboard.press("Escape")
81
+ time.sleep(0.3)
82
+ self._page.keyboard.press("Escape")
83
+ time.sleep(0.3)
81
84
  except: pass
82
85
 
83
86
  def _find_and_click_more(self) -> bool:
@@ -90,7 +93,7 @@ class BrowserDeleter:
90
93
  const r = icon.getBoundingClientRect();
91
94
  if (r.width < 5 || r.height < 5) continue;
92
95
  if (r.y < 100) continue;
93
- icon.dispatchEvent(new MouseEvent('click', {bubbles: true}));
96
+ icon.click();
94
97
  return true;
95
98
  }
96
99
  return false;
@@ -107,7 +110,7 @@ class BrowserDeleter:
107
110
  if (el.offsetParent === null) continue;
108
111
  const txt = el.innerText || el.textContent || '';
109
112
  if (txt.trim() === 'Delete') {
110
- el.dispatchEvent(new MouseEvent('click', {bubbles: true}));
113
+ el.click();
111
114
  return true;
112
115
  }
113
116
  }
@@ -135,8 +138,9 @@ class BrowserDeleter:
135
138
  if (el.offsetParent === null) continue;
136
139
  const txt = el.innerText || el.textContent || '';
137
140
  if (txt.trim() === 'Delete') {
138
- if (el.closest('[role="dialog"], [role="alertdialog"]')) {
139
- el.dispatchEvent(new MouseEvent('click', {bubbles: true}));
141
+ // Must NOT be inside the menu (which we already dismissed)
142
+ if (!el.closest('[role="menu"]')) {
143
+ el.click();
140
144
  return true;
141
145
  }
142
146
  }