Open TheSpyder opened 8 months ago
just change post to get like
@routes.get(config.URL_PREFIX + 'add')
I thought of that, but then how would request.json()
work? I'm not familiar with the framework at all.
well... still you can send a request body with GET
In theory, sure, but I specifically want to use query string parameters so I can avoid the HTTPS restriction with window.open('http://my-server:8081/add?video=window.location&quality=best')
(or something similar, I'd probably need to URL encode the location).
sorry I misunderstood. these may help:
@routes.post(config.URL_PREFIX + 'add')
@routes.get(config.URL_PREFIX + 'add')
async def add(request):
if request.method=="GET":
post=request.query
else:
post = await request.json()
url = post.get('url') .............not changed below
then you can use something like /add?url=http%3A%2F%2Fwww.youtube.com........&quality=best
this is the minimal modification I think
aha! thank you. I might submit a pull request if it works 🤔
@TheSpyder did you try it? Sounds like an easy solution to download videos.
no, I never got around to it before I stopped using the shortcut. I didn't use my phone much for sending videos to metube anyway.
How hard would it be to implement GET support for adding videos, something like
/add?url=myvideo&quality=best
? This would allow the bookmarklet and extension to work without the HTTPS restriction (usingwindow.open()
, which can be any URL).I only have a passing knowledge of Python but adding doesn't seem too complex, the hard part is probably displaying something useful on success (such as redirecting to the main page). https://github.com/alexta69/metube/blob/4a3a27e71cadaea52db51e85ffdbaf0a49beeaf0/app/main.py#L110-L114