Fix YouTube pattern

- Some manual refactoring. Couldn't get nimfmt to work
Signed-off-by: Joseph Nuthalapati's avatarJoseph Nuthalapati <[email protected]>
parent 52ecc638
Pipeline #105237777 passed with stage
in 51 seconds
import htmlparser
import httpClient
import parseopt
import osproc
import sequtils, sugar
import strformat
import std/[terminal]
import strtabs
import strutils
import uri
import xmltree
import
htmlparser,
httpClient,
parseopt,
osproc,
sequtils,
sugar,
strformat,
std/[terminal],
strtabs,
strutils,
uri,
xmltree
import preferences
......@@ -55,22 +57,17 @@ for kind, key, value in getopt():
of cmdEnd:
discard
if "?watch" in searchQuery or "videos/watch" in searchQuery :
if "watch?" in searchQuery or "videos/watch" in searchQuery :
discard execProcess(&"{player} {searchQuery}")
quit(0)
if searchQuery.startswith("magnet:"):
elif searchQuery.startswith("magnet:"):
discard execProcess(&"peerflix \"{searchQuery}\" --{player}")
quit(0)
let searchResults = extractTitlesAndUrls(getYoutubePage(searchQuery))
let number =
if feelingLucky:
0
if feelingLucky: 0
else:
presentVideoOptions(searchResults)
stdout.styledWrite(fgYellow, "Choose video number: ")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment