Fix #31: Make a website with a search engine notably based on the captions extracted

This commit is contained in:
2023-02-14 02:00:23 +01:00
parent 57572c6d6c
commit 21ad878be8
2 changed files with 26 additions and 5 deletions

View File

@@ -17,7 +17,7 @@ Access raw data with: <?php echoUrl('channels/'); ?>.
<input type="submit" id="search-only-captions" value="Search only captions">
</form>
Progress: <span id="progress"></span>
Progress: <span id="progress"></span> channels
<ul id="channels">
</ul>
@@ -42,6 +42,12 @@ Progress: <span id="progress"></span>
document.getElementById('progress').innerHTML = line.replace('progress:', '');
} else {
var channelsDom = document.getElementById('channels');
var timestamp = null;
if (line.includes('|')) {
const lineParts = line.split('|');
timestamp = parseInt(lineParts[1]);
line = lineParts[0];
}
const channelFileParts = line.split('/');
const channel = channelFileParts[0];
const channelFile = channelFileParts.slice(1).join('/');
@@ -60,6 +66,13 @@ Progress: <span id="progress"></span>
var channelFileDom = document.createElement('li');
var a = createA(channelFile, `${channelHref}/${channelFile}`);
channelFileDom.appendChild(a);
if (timestamp != null) {
const space = document.createTextNode('\u00A0');
channelFileDom.appendChild(space);
const id = channelFileParts[2];
var a = createA(`${timestamp} s`, `https://www.youtube.com/watch?v=${id}&t=${timestamp}`);
channelFileDom.appendChild(a);
}
channelFilesDom.appendChild(channelFileDom);
}
}