jkCli/display.py

27 lines
620 B
Python
Raw Permalink Normal View History

2022-02-16 12:49:12 +00:00
from bs4 import BeautifulSoup
import requests
import webbrowser
#get ep url
def get_vid(url):
webp = requests.get(url)
soup = BeautifulSoup(webp.text, 'html.parser')
res = soup.find_all('html')
raw = str(res)
vid = raw.split('var video')
r = vid[1]
src = r.split('src=')
src = str(src).replace('"', '')
sour = str(src).split(' width')
end = str(sour).split(',')
links = []
for x in end:
if '.net' in x:
links.append(x[2:-1])
return links
#opens link in a firefox tab (couldnt make mpv work yet :c)
def display(url):
webbrowser.open_new(url)