29
29
30
30
31
31
class EmailAutomationApp (QMainWindow ):
32
- log_signal = pyqtSignal (str )
32
+ log_signal = pyqtSignal (str )
33
+ link_signal = pyqtSignal (str )
33
34
def __init__ (self ):
34
35
super ().__init__ ()
35
36
self .lock = Lock ()
36
37
self .log_signal .connect (self .update_log_output ) # اتصال سیگنال به متد
38
+ self .link_signal .connect (self .update_links_output )
37
39
self .setWindowTitle ("Email Automation Tool" )
38
40
self .setGeometry (100 , 100 , 800 , 600 )
39
41
@@ -45,11 +47,14 @@ def __init__(self):
45
47
self .create_link_extractor_tab ()
46
48
self .create_email_extractor_tab () # New tab for extracting emails from URLs
47
49
self .create_email_sender_tab ()
50
+ # =======================end tab===============================
48
51
#============================signals=======================
49
52
def update_log_output (self , message ):
50
53
self .log_output .append (message ) # به روز رسانی لاگ در ترد اصلی
54
+
55
+ def update_links_output (self , link ):
56
+ self .links_result .append (link )
51
57
# ==========================================================
52
- # =======================end tab===============================
53
58
# ================== start tab ==================
54
59
def create_link_extractor_tab (self ):
55
60
"""Tab for extracting links from search results"""
@@ -184,9 +189,6 @@ def add_label_input_pair(label_text, input_field):
184
189
self .tabs .addTab (tab , "Email Sender" )
185
190
# ======================== end tab =======================
186
191
# =========================start link extract =====================
187
-
188
-
189
-
190
192
def start_link_extraction (self ):
191
193
"""Start the link extraction process in a separate thread"""
192
194
search_query = self .search_input .text ()
@@ -237,12 +239,13 @@ async def extract_links_async(self, search_query):
237
239
current_links = process_links (driver )
238
240
valid_links = await validate_links (current_links )
239
241
links .update (valid_links )
242
+ for link in valid_links :
243
+ self .link_signal .emit (f"Found links: { link } " ) # Emit found links
240
244
241
245
with open (file_name , "a" ) as file :
242
246
for link in valid_links :
243
247
file .write (link + "\n " )
244
248
245
- self .log_signal .emit (f"Found links: { valid_links } " ) # Emit found links
246
249
247
250
await asyncio .sleep (random .uniform (1 , 3 ))
248
251
0 commit comments