Comments (7)
Hi @plata. Unfortunately, the way Paperoni is currently organized, it can't be exported even as a Rust library crate. But I have plans to make some parts available as libraries.
I also haven't worked with the parts of allowing for FFI bindings so that it can be called from C/C++ or any other language for that matter.
Which parts had you wanted to access as a library?
from paperoni.
My use case would be to call paperoni with the URL (or HTML + URL) and get back the "cleaned" HTML.
So something like: std::string paperoni(const std::string& url)
from paperoni.
Alright. Well that could be doable without needing to make FFI bindings.
You could instead call paperoni in a shell in C/C++ (I don't know the exact term used to refer to shelling out in C/C++) and then read the value returned from stdout
back into a string
in your C/C++. This assumes that you want to use paperoni in a context that permits shelling out.
NOTE: Getting content from stdout
isn't actually supported yet so this is just a hypothetical solution.
Would that work for you?
from paperoni.
I fear it won't work. It shall also work on Android and my current knowledge is that starting a subprocess there is an issue. However, my Android knowledge is limited so this might be wrong.
from paperoni.
If it's going to be on Android then it certainly won't work with that approach.
If all you needed was to pass in some HTML and get back some HTML containing only the article, then you only need the readability
portion of paperoni which is actually based on the Mozilla library. There's many existing ports to other languages, for example in Android you can use Kotlin libs like Readabilty4J and crux. I've not tried them but they seem to do just the same thing.
There's also this arc90 readability C++ port which isn't exactly the same as the Mozilla one but should be sufficient for your needs.
from paperoni.
I'm aware about the Kotlin implementations and yes, I could probably use that as a service on Android. However, I would prefer a solution which works for Linux/Windows as well.
Which C++ port are you referring to? rdrview? I've tried that, it's only an executable.
Don't get me wrong, I'm not asking you to solve my problems. Feel free to close the issue if paperoni as library doesn't fit into your plans.
from paperoni.
Making the readability portion of paperoni an independent library is definitely something I had planned for but having FFI bindings for C/C++ is definitely out of its scope. I hope you get a solution for your needs though.
If and when I do make it a library crate, I might reopen this issue but don't hold your breath for that.
from paperoni.
Related Issues (9)
- Using as a library HOT 2
- Option to add multiple URLs as chapters HOT 3
- Missing images are not handled HOT 2
- img src gets mangled on some images HOT 7
- Text too small on e-reader HOT 8
- Include title in document HOT 6
- Can I install it or builds for Windows10? HOT 5
- Project still maintained/developed? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from paperoni.