CustomWebview inject javascript

I have python code

f = open(“index.html”, “r”)
kod = f.readlines()
f.close()

file = “”

for i in kod:
if “var player = new Playerjs” in i:
file = i.split(‘file:"’)[1].split(’"’)[0]
print(file)
break

how can i add this to custom webview
or can anyone make the javascript code of this code