VideoHelp Forum




+ Reply to Thread
Results 1 to 7 of 7
  1. When I visit this website, I want to get a vtt subtitle file, but when I open the developer tool options, the VTT subtitle file I get is as shown in the figure. How should I deal with this subtitle file? I want to get a subtitle file of normal format and size. What should I do? Is there a good way?The Website address:https://www.ctv.ca/shows/love-island-usa/episode-1-s7e1
    Image
    [Attachment 87315 - Click to enlarge]
    Image
    [Attachment 87316 - Click to enlarge]
    Last edited by pipaguo; 7th Jun 2025 at 04:06.
    Quote Quote  
  2. I have another question, if anyone can answer it. I want to know if the subtitles on the website Crave can be obtained? Are the subtitles on that website in the normal format and size? I don't have a Crave account yet. I am considering whether to register one. But I am afraid that the VTT subtitles on Crave will be the same as the subtitles on CTV. Then the account will be registered in vain. Because I only want the subtitle file of this program, I am not interested in other programs and their subtitles.
    Quote Quote  
  3. Member
    Join Date
    Mar 2021
    Location
    Israel
    Search Comp PM
    Weird way to present subtitles.
    If there is no good solution to this problem, I think I would save my time by doing audio to text transcription, at least I would get full text subtitles this way
    Quote Quote  
  4. script.py
    Code:
    import sys
    import re
    import requests
    from urllib.parse import urlparse
    import os
    
    def clean_vtt_content(content):
        pattern = r'(-->.*?)\s+line:\d+% align:center'
        cleaned = re.sub(pattern, r'\1', content)
        return cleaned
    
    def get_filename_from_url(url):
        parsed = urlparse(url)
        return os.path.basename(parsed.path)
    
    def main():
        if len(sys.argv) != 2:
            print("Usage: python3 script.py <URL_to_vtt_file>")
            sys.exit(1)
    
        url = sys.argv[1]
        filename = get_filename_from_url(url)
    
        try:
            response = requests.get(url)
            response.raise_for_status()
            content = response.text
    
            cleaned_content = clean_vtt_content(content)
    
            with open(filename, 'w', encoding='utf-8') as f:
                f.write(cleaned_content)
    
            print(f"Cleaned VTT saved as: {filename}")
    
        except requests.exceptions.RequestException as e:
            print(f"Error fetching the VTT file: {e}")
            sys.exit(1)
    
    if __name__ == "__main__":
        main()
    usage
    Code:
    python script.py https://capi.9c9media.com/destinations/ctv_hub/platforms/desktop/playback/contents/3128780/contentPackages/7561131/manifest.vtt
    Quote Quote  
  5. Originally Posted by Frieren View Post
    script.py
    Code:
    import sys
    import re
    import requests
    from urllib.parse import urlparse
    import os
    
    def clean_vtt_content(content):
        pattern = r'(-->.*?)\s+line:\d+% align:center'
        cleaned = re.sub(pattern, r'\1', content)
        return cleaned
    
    def get_filename_from_url(url):
        parsed = urlparse(url)
        return os.path.basename(parsed.path)
    
    def main():
        if len(sys.argv) != 2:
            print("Usage: python3 script.py <URL_to_vtt_file>")
            sys.exit(1)
    
        url = sys.argv[1]
        filename = get_filename_from_url(url)
    
        try:
            response = requests.get(url)
            response.raise_for_status()
            content = response.text
    
            cleaned_content = clean_vtt_content(content)
    
            with open(filename, 'w', encoding='utf-8') as f:
                f.write(cleaned_content)
    
            print(f"Cleaned VTT saved as: {filename}")
    
        except requests.exceptions.RequestException as e:
            print(f"Error fetching the VTT file: {e}")
            sys.exit(1)
    
    if __name__ == "__main__":
        main()
    usage
    Code:
    python script.py https://capi.9c9media.com/destinations/ctv_hub/platforms/desktop/playback/contents/3128780/contentPackages/7561131/manifest.vtt
    Can I get normal vtt subtitles through this? Instead of the messy subtitles mentioned above? If so, can you provide a video of the operation? I am not in the field of python.
    Quote Quote  
  6. Originally Posted by videoAI View Post
    Does this help?
    The-Stream-Detector
    No, it's not that I can't get the vtt file, but the VTT file I get is not in the normal format as shown in the picture above. I can get vtt subtitles through the developer options.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!