Greasy Fork is available in English.

Netflix - subtitle downloader

Allows you to download subtitles from Netflix

< Feedback on Netflix - subtitle downloader

Review: OK - script works, but has bugs

§
Posted: 24.05.2023
Edited: 24.05.2023

When downloading a .vtt subtitle with the script

the second line after the NOTEs is always filled with many spaces

this causes some video players to fail displaying the vtt subtitle files because its invalid vtt syntax

are these spaces already inside the original file or is this a bug from the script?

§
Posted: 24.05.2023
Edited: 24.05.2023

Netflix. I don't process the subs at all. As I said in the description, you can use some program to convert the subs to another format.

Does your script fetch .vtt files themselves, or does it build'em through source-code? If they are built, maybe it could be an easy improvement: the initial description from OP is not the best. It's just a matter of erasing anything that matches this RegEx: ^ +$.

That also means it's also an easy fix for the end user, we just need to run this replacement (with Notepad++, e.g.) for a whole folder and it's done.

Why this fix, then? Because while SubtitleEdit parses easily through this, FFmpeg does not, which increases the number of steps in any post-processing.

Thanks

§
Posted: 14.11.2023

Like I said, I don't process the subs at all. And I don't plan to start doing it.

§
Posted: 15.11.2023

was able to do it with a ps script with this regex pattern and replacement
$pattern = "(NOTE /SegmentIndex\r?\n)(\s*\r?\n)+(?=1)"
$replacement = "`$1`r`n`r`n`r`n`r`n"


Fix-NetflixVTT.ps1
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing

# Create a FolderBrowserDialog object
$folderBrowserDialog = New-Object System.Windows.Forms.FolderBrowserDialog

# Set the initial directory to the one you want to open by default
$folderBrowserDialog.RootFolder = [System.Environment+SpecialFolder]::MyComputer
$folderBrowserDialog.SelectedPath = "E:\DVDFab\StreamFab\Output\Netflix"

# Show the Folder Browser Dialog
$dialogResult = $folderBrowserDialog.ShowDialog()

# Check if a folder was selected
if ($dialogResult -eq [System.Windows.Forms.DialogResult]::OK) {
# Get the selected folder path
$selectedFolderPath = $folderBrowserDialog.SelectedPath

# Find all .vtt files in the selected folder and its subfolders
$selectedFiles = Get-ChildItem -Path $selectedFolderPath -Filter *.vtt -Recurse -File

# Pattern matching the text to be replaced
$pattern = "(NOTE /SegmentIndex\r?\n)(\s*\r?\n)+(?=1)"
$replacement = "`$1`r`n`r`n`r`n`r`n"

# Process each .vtt file
foreach ($file in $selectedFiles) {
# Read the file content
$fileContent = Get-Content -Path $file.FullName -Raw

# Perform the replacement
$modifiedContent = [Regex]::Replace($fileContent, $pattern, $replacement, [Text.RegularExpressions.RegexOptions]::Singleline)

# Write the modified content back to the file
Set-Content -Path $file.FullName -Value $modifiedContent
}
}

# Clean up and dispose the FolderBrowserDialog object
$folderBrowserDialog.Dispose()

@Christian Gambale that's very interesting. But as I said, it's very easy to do it by hand. That's my last comment started with a question: if the script instantly fetches an out-of-the-box ready .vtt file, I also wouldn't bother to process it. The script serves to get subtitles and if it already has a .vtt file, its work is done.

On the other hand, while I don't understand .js, I could see references to .trim and .replace methods. If that means the .vtt files are being built from JSON, XML or something else, I'd be simply proposing one more call to .replace without adding a whole new function and disrupting the workflow.

§
Posted: 15.11.2023

For the third time - NO, I don't process the subs. You want to mess with subs? Do it either between lines 471 and 472 or between 481 and 482 of my script.

@Tithen-Firion there's no need for that tone. I've never asked you to implement anything at all. Both my comments are questions about how the script works. I would not learn a whole new language (and how it deals with JSON, XML etc.) just to inspect the code by myself and find out there's nothing I can do. I.e., if the .vtt is fetched instead of built.

I would, however, be willing to learn just enough to try to work it out by myself and either submit a PR, or simply edit only my local copy on TamperMonkey.

I've been using this script for a long time, I read the description. I've always created the .srts by myself, even from before there was that .bat in the description, but never came here to ask for it to output .srts.

It's understandable how annoying it must have been since first release to have people asking for the feature you specifically said you didn't intend to implement, but you still should have noticed that this is not what I'm asking for. Or was.

Thank you again for your time

§
Posted: 16.11.2023

If they are built, maybe it could be an easy improvement

 

I'd be simply proposing one more call to .replace

 

I've never asked you to implement anything at all.

If they are built, maybe it could be an easy improvement

I'd be simply proposing one more call to .replace

That's a really reckless way to read anything. The very quotes you chose actually prove my point: read them carefully and figure out if either mentions you at all or the code itself.

"An easy improvement" means that regardless of not knowing .js, if it was simple enough, perhaps even I could figure how to add a .replace call. "Proposing" means I would submit my changes to your approval (i.e., a PR), since you're the owner and maintainer of the script.

Well, it's a shame things came to this animosity, but you still have my regards,

Thanks for your work and your time.

Post reply

Sign in to post a reply.