antiboredom / videogrep

automatic video supercuts with python
https://antiboredom.github.io/videogrep
Other
3.33k stars 257 forks source link

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

Closed 0ihsan closed 3 years ago

0ihsan commented 4 years ago

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'
DarkCeptor44 commented 4 years ago

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

0ihsan commented 4 years ago

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

videogrep --input videofile.mkv -vtt --search this --search-type word
DarkCeptor44 commented 4 years ago

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

0ihsan commented 4 years ago

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.

KoolenDasheppi commented 4 years ago

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.