- Add youtu.be to streaming videos list.

- Make feh and mpv run independently of the program.
master
VikingKong 3 years ago
parent 78e2b672b5
commit ecaeabf541

@ -3,6 +3,7 @@ import yaml
import asyncio
import warnings
import subprocess
import os
from concurrent.futures import ThreadPoolExecutor
from API import Fetcher
from Render import Article
@ -220,10 +221,10 @@ class Links(urwid.ListBox):
def parseLink(self, link):
ext = link.split(".")[-1]
if ext.lower() in ("jpg", "jpeg", "gif", "png", "tif", "tiff"):
subprocess.Popen(['feh', link])
os.system('nohup feh ' + link + ' 2>/dev/null &')
elif Utils.checkStreamingVideo(link):
tui.destroyOverlay()
subprocess.Popen(['mpv', "--ytdl-format=bestvideo[height<=720]+bestaudio/best[height<=720]", link])
os.system('nohup mpv --ytdl-format="bestvideo[height<=720]+bestaudio/best[height<=720]" "' + link + '" 2>/dev/null &')
else:
subprocess.Popen(['firefox', '-new-tab', link])

@ -1,13 +1,18 @@
from datetime import datetime
import re
streaming_urls = ["^https://www.youtube.com", "^https://player.odycdn.com", "^https://youtu.be"]
def timestampToDate(ts):
return datetime.fromtimestamp(int(ts)/1000000).strftime("%y-%m-%d %H:%M")
def checkStreamingVideo(link):
return re.search("^https://www.youtube.com", link) is not None or re.search("^https://player.odycdn.com", link)
for pattern in streaming_urls:
if re.search(pattern, link) is not None:
return True
return False
def checkReddit(link):

Loading…
Cancel
Save