freyta / WWE-Network-Downloader

My own WWE downloader.
40 stars 13 forks source link

Include Subtitles #8

Closed ghost closed 2 years ago

ghost commented 4 years ago

A good amount of videos have subtitles, if you were interested in adding them in:

Sample code:

def get_subtitle(self, stream_link, episode_title):
    print("\nStarting to write subtitle")
    stream = self._session.get(stream_link, headers=CONSTANTS.REALM_HEADERS).json()

    if 'subtitles' in stream:
        for subtitle in stream['subtitles']:
            if subtitle.get('format') == 'srt':
                subtitle_url = subtitle['url']
        r = requests.get(subtitle_url, allow_redirects=True)
        open("{}/{}.srt".format(CONSTANTS.OUTPUT_FOLDER, episode_title), "wb").write(r.content)
    print("Finished writing subtitle")

and add to the ffmpeg command: -i input.srt -c copy -c:s mov_text

(Or you could switch to MKV, but that would require reformatting the chapter-ized output)

freyta commented 4 years ago

Hey.

Thanks for that. I didn't add it in because their subtitles are weirdly delayed from me using a web browser. In saying that, if you want, you can create a pull request and I'll add it in.

Nisekoi-1 commented 3 years ago

Yes, please add Subtitles options and able to download Subtitles Only.

FiftyFour7250 commented 2 years ago

@freyta Hey, can you please add a subtitle download? yes, maybe they are delayed, but for people who need them, it's not so important, you know what I mean? In addition, many players have the ability to speed up/slow down subtitles. Please...

freyta commented 2 years ago

Commit https://github.com/freyta/WWE-Network-Downloader/commit/82ed598b72dc0418d8972455a45cc4d275e5210b fixes this.

The subtitles are actually a lot better now than they used to be. Sorry for the delay in adding it!

FiftyFour7250 commented 2 years ago

@freyta I'm getting an error...

image

ghost commented 2 years ago

modify https://github.com/freyta/WWE-Network-Downloader/blob/master/wwe.py#L79 to

vtt_file.write(subtitle_data, encoding='utf-8')