diff --git a/website/index.php b/website/index.php
index 2d7fd93..ad2d919 100644
--- a/website/index.php
+++ b/website/index.php
@@ -13,7 +13,8 @@ Access raw data with: .
Access found channels with: .
@@ -82,7 +83,7 @@ Progress: channels
function search(event) {
// We don't want to refresh the webpage which is the default behavior.
event.preventDefault();
- const query = event.submitter.id + ' ' + document.getElementById('search').value;
+ const query = event.submitter.id + ' ' + document.getElementById('path-search').value + ' ' + document.getElementById('search').value;
if (firstRun) {
firstRun = false;
conn = new WebSocket('wss://crawler.yt.lemnoslife.com/websocket');
diff --git a/website/search.py b/website/search.py
index 6d81556..b90e0e0 100755
--- a/website/search.py
+++ b/website/search.py
@@ -6,10 +6,11 @@ from io import StringIO
path = '/mnt/HDD0/YouTube_captions_search_engine/channels/'
clientId = sys.argv[1]
-message = sys.argv[2]
+pathSearchMessageParts = sys.argv[2].split(' ')
+pathSearch = pathSearchMessageParts[1]
+message = ' '.join(pathSearchMessageParts[2:])
-searchOnlyCaptions = message.startswith('search-only-captions ')
-message = message[message.find(' ') + 1:]
+searchOnlyCaptions = pathSearchMessageParts[0] == 'search-only-captions'
clientFilePath = f'users/{clientId}.txt'
@@ -41,8 +42,10 @@ for fileIndex, file in enumerate(files):
endsWithVtt = fileInZip.endswith('.vtt')
if searchOnlyCaptions and not endsWithVtt:
continue
+ toWrite = f'{file}/{fileInZip}'
+ if not pathSearch in toWrite:
+ continue
with zip.open(fileInZip) as f:
- toWrite = f'{file}/{fileInZip}'
if endsWithVtt:
content = f.read().decode('utf-8')
stringIOf = StringIO(content)