Skip to content

Commit

Permalink
Merge pull request #4 from ncallan/master
Browse files Browse the repository at this point in the history
add direct route
  • Loading branch information
ash-ishh authored Oct 29, 2019
2 parents c7b7285 + 9aa7c15 commit a049a2d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@ def index():
name = None
nolinks = False

if(form.validate_on_submit()):
if request.method == "GET":
videoid = request.args.get("v")
if len(videoid) == 11 and any([i in "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_" for i in videoid]):
logger.info(f"Request from: {request.remote_addr}")
name, links = utube_dl.download("https://www.youtube.com/watch?v=" + videoid)
nolinks = True if len(links) == 0 else False
elif (form.validate_on_submit()):
logger.info(f"Request from: {request.remote_addr}")
session["url"] = form.url.data
name, links = utube_dl.download(session.get("url"))
Expand Down

0 comments on commit a049a2d

Please sign in to comment.