Commit 32f36538 authored by TheTechRobo's avatar TheTechRobo
Browse files

Add API endpoint to coerce a URL into an ID

parent 8326dafd
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -100,6 +100,15 @@ async def noscript_load():
    """ % id, headers=(("FinUrl", f"/noscript_load_thing.html?id={id}"),))
    return response, 302

@app.route("/api/coerce_to_id")
async def coerce_to_id_endpoint():
    if not request.args.get("d"):
        return '"No d param provided"', 400
    id = coerce_to_id(request.args['d'])
    if not id:
        return '"Could not parse the video ID out of that"', 400
    return {"data":id}

@app.route("/noscript_load_thing.html")
async def load_thing():
    if not request.args.get("id"):