iawia002 / lux

👾 Fast and simple video download library and CLI tool written in Go
MIT License
27.83k stars 3k forks source link

browser extension #80

Open iawia002 opened 6 years ago

iawia002 commented 6 years ago

just one click, construct the parameters(with cookies), then open the terminal

noelyahan commented 6 years ago

In this case only problem I see is the opening the terminal part. Because the browser is running inside the secure sandbox it wont allow to communicate with os processes. But for Internet Explorer ActiveX object we can handle it.

What if the annie can expose a background service to make a grpc/http call from the browser extention locally to spawn annie download process.

iawia002 commented 6 years ago

Thanks for pointing this out, I am not familiar with Chrome's API (or other browsers). This is just an idea at the time. I don't know how to implement it, or whether it is necessary to do it.

noelyahan commented 6 years ago

Hi @iawia002 I did some further research and found out 2 ways that can communicate with native applications.

  1. NPAPI [Deprecated]
  2. Native Messaging API

The NPAPI was deprecated and, Native messaging API is working fine with current chrome browsers. chrome-native

I would like to give try on this feature by developing the annie chrome extension.

iawia002 commented 6 years ago

Nice! Thanks for doing this. You can give it a try, when you make some progress, please let me know

noelyahan commented 6 years ago

I implemented a chrome extension under feature-browser-ext branch :) Demo. And now I'm working on improvements (Pause, Resume, Stop, Delete, Open). I used intermediate host because currently I didn't wanted to mess up with the main.go app. Later we can avoid this intermediate host app and integrate with the main app.

iawia002 commented 6 years ago

The demo looks fine!

However, I am a little worried about it. To use this, I need to install the host first, which may be a bit troublesome for the user.

So I have a suggestion, for all users, we show the constructed download parameters (with cookies, one more question here, I don't know if Chrome allows reading cookies?) which can be easily copied, for the user who installed host, we will show them a download button, they can download the video directly if they want.

noelyahan commented 6 years ago

I agree, It's better to provide both solutions. yes chrome extension allows to use cookies. As an example if a user want's to download a playlist do the extension needs

  1. Provide only the clipboard command and params to run the annie manually
  2. Provide a UI to tweak some parameters such as quality, selected videos
iawia002 commented 6 years ago

The first version doesn't need to be too complicated, maybe just a clipboard and a download button.

And one more thing, choose the quality may be a little tricky, you won't know what quality provided unless you run annie -i URL... command in the terminal.