Download Streaming Videos Using Selenium

I know we can download streaming videos using the following approach.

import m3u8
import requests
from bs4 import BeautifulSoup
from tqdm import tqdm_notebook as tqdm
import subprocess

sess = requests.Session()
r = sess.get("")
soup = BeautifulSoup(r.content, 'html5lib')
video_id = soup.find('video', attrs={'id': 'playlistPlayer'})['data-video-id']
account_id = soup.find('video', attrs={'id': 'playlistPlayer'})['data-account']

url = ""

params = {
    'videoId': video_id,
    'pubId': account_id,
    'secure': True

r = sess.get(url, params=params)

m3u8_master = m3u8.loads(r.text)
m3u8_playlist_uris = [playlist['uri'] for playlist in['playlists']]
playlist_uri = m3u8_playlist_uris[0]

r = sess.get(playlist_uri)
playlist = m3u8.loads(r.text)
m3u8_segment_uris = [segment['uri'] for segment in['segments']]

with open("video.ts", 'wb') as f:
    for segment_uri in tqdm(m3u8_segment_uris):
        r = sess.get(segment_uri)
        f.write(r.content)['ffmpeg', '-i', 'video.ts', 'video.mp4'])

However, it sometimes trigger high bot scores.

So, I do not want to send request to the server directly using my script. I am trying to use chrome (using selenium) to load the full video and then download the video from the browser.

However, I am not sure how to address this issue. What might be the solution here?