VideoHelp Forum




+ Reply to Thread
Results 1 to 4 of 4
  1. I'm trying to extract the subtitles from this website... but they are displayed like the image.. could someone help me..

    https://home.hitv.vip/es-es/series/mary-kills-people/1?frm=history_index



    Thanks in advance
    責任者-MDX
    Quote Quote  
  2. press F12 to open Chrome DevTools and go to the Sources tab
    In the search bar (Ctrl + P), search for:
    home.hitv.vip/js/hiplayer.min.da039b8436907c12bae3.js


    Right-click the file and select "Override"

    Note: If it’s your first time using Overrides, enable it under the Overrides tab in DevTools and select a folder for local changes.

    Search inside the file for the following line:
    Code:
    n.resolveSubtitle = function(e, t) {
    This is the function responsible for handling subtitle data.

    Replace the entire function with the following modified version:
    Code:
                n.resolveSubtitle = function(e, t) {
                    var r;
                    if (this.video.textTracks && this.video.textTracks.length > 0)
                        for (var i = this.video.textTracks.length, n = 0; n < i; n++) {
                            var a = this.video.textTracks[n];
                            a && "subtitle-xml" === a.label && (r = a)
                        }
                    r || ((r = this.video.addTextTrack("metadata", "subtitle-xml")).mode = "showing");
                    var subtitlesData = [];
                    for (var o = e.dias || [], s = 0; s < o.length; s++) {
                        var l = o[s]
                          , u = l.st
                          , h = l.et
                          , c = l.con;
                        t.offset && (u += t.offset,
                        h += t.offset),
                        t.secret && (c = Ae(t.secret.key, t.secret.iv, c));
                        subtitlesData.push({
                            startTime: u,
                            endTime: h,
                            text: c
                        });
                        var d = new VTTCue(u,h,c)
                          , f = e.note.height
                          , p = e.note.width;
                        this.container && this.container.setAttribute("base-width", "" + p),
                        l.style && (d.style = Ce({
                            baseW: p,
                            baseH: f
                        }, l.style)),
                        d.id = s + "",
                        r.addCue(d)
                    }
                    
                    var srtContent = "";
                        for (var i = 0; i < subtitlesData.length; i++) {
                            var subtitle = subtitlesData[i];
                            
                            srtContent += (i + 1) + "\n";
                            
                            var formatTime = function(time) {
                                var hours = Math.floor(time / 3600);
                                var minutes = Math.floor((time % 3600) / 60);
                                var seconds = Math.floor(time % 60);
                                var milliseconds = Math.floor((time % 1) * 1000);
                                
                                return hours.toString().padStart(2, '0') + ":" + 
                                       minutes.toString().padStart(2, '0') + ":" + 
                                       seconds.toString().padStart(2, '0') + "," + 
                                       milliseconds.toString().padStart(3, '0');
                            };
                            
                            srtContent += formatTime(subtitle.startTime) + " --> " + formatTime(subtitle.endTime) + "\n";
                            
                            srtContent += subtitle.text + "\n\n";
                        }
                        
                        setTimeout(() => {
                            try {
                                var blob = new Blob([srtContent], {type: 'text/plain;charset=utf-8'});
                                var url = URL.createObjectURL(blob);
                                var a = document.createElement('a');
                                a.href = url;
                                a.download = 'sub.srt';
                                a.style.display = 'none';
                                document.body.appendChild(a);
                                a.click();
                                
                                setTimeout(() => {
                                    document.body.removeChild(a);
                                    URL.revokeObjectURL(url);
                                }, 100);
                                
                            } catch (error) {
                                console.error('Error downloading SRT file:', error);
                            }
                        }, 100);
                    return r
                }
    The result:
    Once the subtitles are loaded and the video starts, this code will automatically generate and download an .srt file

    download: https://gofile.io/d/yTT3hT
    Quote Quote  
  3. @Frieren ... Thank thanks for the sub.

    @umr_saleh ... Thanks for the method as detailed as always. 📝
    責任者-MDX
    Quote Quote  



Similar Threads

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