forked from MargotP/telegram_similar_channels_finder
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathremove_processed_channels.py
More file actions
42 lines (34 loc) · 1.47 KB
/
remove_processed_channels.py
File metadata and controls
42 lines (34 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import json
from typing import List, Set
# Load the original channels
with open('VERIFY.JSON', 'r', encoding='utf-8') as f:
original_data = json.load(f)
original_channels = set(original_data['similar_channels'])
# Load the job-related channels
with open('job_channels.json', 'r', encoding='utf-8') as f:
job_channels = set(json.load(f)['similar_channels'])
# Add the most recently scanned channels (from the latest run)
recently_scanned = {
"freid_ko",
"frelanserr",
"friendsfoundation"
}
# Add all job-related channels to processed set
processed_channels = set(job_channels)
# Add the first 201 channels to processed set
# We know from the log that 201 channels were processed in total
sorted_channels = sorted(original_channels)
for channel in sorted_channels:
processed_channels.add(channel)
if len(processed_channels) == 204: # 201 + 3 recent scans
break
# Remove processed channels from original set
remaining_channels = list(original_channels - processed_channels)
# Save the remaining channels back to VERIFY.JSON
with open('VERIFY.JSON', 'w', encoding='utf-8') as f:
json.dump({'similar_channels': remaining_channels}, f, ensure_ascii=False, indent=2)
print(f"Original channels: {len(original_channels)}")
print(f"Job-related channels: {len(job_channels)}")
print(f"Non-job processed channels: {204 - len(job_channels)}")
print(f"Total processed channels: {len(processed_channels)}")
print(f"Remaining channels: {len(remaining_channels)}")