antiboredom/videogrep

`--search-type word` is giving a KeyError

0ihsan opened this issue · 5 comments

I run this command:

videogrep --input videofile.mkv -vtt --search 'this' --search-type word

And get this:

Traceback (most recent call last):
  File "/usr/local/bin/videogrep", line 5, in <module>
    videogrep.main()
  File "/usr/local/lib/python3.8/site-packages/videogrep/videogrep.py", line 528, in main
    videogrep(args.inputfile, args.outputfile, args.search, args.searchtype, args.maxclips, args.padding, args.demo, args.randomize, args.sync, args.use_transcrip
t, args.use_vtt, args.export_clips)
  File "/usr/local/lib/python3.8/site-packages/videogrep/videogrep.py", line 453, in videogrep
    composition = compose_from_vtt(vtts, search, searchtype)
  File "/usr/local/lib/python3.8/site-packages/videogrep/videogrep.py", line 416, in compose_from_vtt
    for word in sentence['words']:
KeyError: 'words'

Run the command but without the singular quote ' on the search term.

It is the same error when I remove the singular quotes from search term.

videogrep --input videofile.mkv -vtt --search this --search-type word

From my end it works every time with that same command so would you mind uploading the input file and subtitle?

I downloaded this YouTube video (mkv format) and am using this subtitle file.

By the way the command runs when I remove --search-type word (but I want to cut only the words from the video after all). It is only for word, pos and some other type that I can't recall now. Those three search types give the same error message.

Those aren't automatically generated subtitles. If you're using youtube-dl, I had the same issue. Currently, if a video has manual English subtitles written for it, --write-auto-sub in youtube-dl will just download the manual ones instead of the auto ones. So you'll have to wait for a fix from youtube-dl, find another way to download auto .vtt, or just pick a video with no manual subtitles.