YouTube_captions_search_engine/removeChannelsBeingTreated.py

26 lines
622 B
Python

#!/usr/bin/python3
import shutil
infix = ': Treating channel '
path = 'channels/'
threads = {}
with open('nohup.out') as f:
lines = f.read().splitlines()
for line in lines:
if infix in line:
#print(line)
threadId = line.split(': ')[1]
channelId = line.split(infix)[1].split(' (')[0]
threads[threadId] = channelId
for threadId in threads:
channelId = threads[threadId]
print(threadId, channelId)
try:
shutil.rmtree(path + channelId)
os.remove(path + channelId + ".zip")
except:
pass