Comments (7)
Great, I'll have a go at it in the coming days, probably next week.
from unfurl.
Hi there, this sounds great! Building in a proper API function to Unfurl has been on my list for a while, but there were a few issues (I haven't built one before and I wasn't sure what requirements a consumer of the API would have). If you wanted to build the API part, that'd be awesome and I'd be happy to help however I can. There's an existing /api/
route for the web app, but it's not a true API by any means. I'd welcome ideas/code from someone who actually knows what they're doing.
As for JSON output, getting JSON isn't hard (it's used internally and there's already a generate_json
function that builds a JSON object of the nodes and edges - it's in the format need by vis.js Network, as that's what's used to display the Unfurl graph. I'm not sure what structure of JSON would be helpful for your use case, but I could tweak it or build another JSON output function if needed.
from unfurl.
I started to play with the app, but I have a quick question before I do so: the public instance expects links that look like that: https://dfir.blog/unfurl/?url=https://www.example.com/path/index.html?a=1&b=2
when the current HEAD on the master branch goes for http://localhost:5000/https://www.example.com/path/index.html?a=1&b=2
The URL to expand in the public instance is a parameter (url
), which is not the case on the current code. Is it expected? Is there a missing commit for the code on github?
(sorry, editing this message as I look at the code) an URL like that:
http://localhost:5000/?url=magnet:?xt=urn:btih:c9e15763f722f23e98a29decdfae341b98d53056&dn=Cosmos+Laundromat&tr=udp%3A%2F%2Fexplodie.org%3A6969&tr=udp%3A%2F%2Ftracker.empire-js.us%3A1337&tr=wss%3A%2F%2Ftracker.btorrent.xyz&ws=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2F&xs=https%3A%2F%2Fwebtorrent.io%2Ftorrents%2Fcosmos-laundromat.torrent
will not be processed properly because of the &
that are interpreted as URL params by default:
ImmutableMultiDict([('url', 'magnet:?xt=urn:btih:c9e15763f722f23e98a29decdfae341b98d53056'), ('dn', 'Cosmos Laundromat'), ('tr', 'udp://explodie.org:6969'), ('tr', 'udp://tracker.empire-js.us:1337'), ('tr', 'wss://tracker.btorrent.xyz'), ('ws', 'https://webtorrent.io/torrents/'), ('xs', 'https://webtorrent.io/torrents/cosmos-laundromat.torrent')])
The reason it works right now is because you use the referrer to extract the URL to expand. I understand it makes things easier to copy/paste a URL, but would you consider requiring an url encoded parameter instead?
from unfurl.
okay, so here is a small PR, I figured out a way to keep the current approach to submit a URL without requiring quoting it first. Please let me know what you think and if you're ok with that, I'll implement the non-visjs API part.
from unfurl.
My initial idea for Unfurl was for the user to be able to be on a site, then insert unfurl.link/
in the address bar before the current page URL, then get the Unfurled result. This wasn't as easy as I had hoped and I got it (mostly) working on the public site via redirection shenanigans. It does work on the local app (substituting localhost:port for the domain of course).
For the public instance, it's powered by GCP cloud functions, so I actually base64 encode the url
parameter before sending, then decode it in the cloud function. None of this is ideal, and I'll like redo a lot of it using the new API, as that seems a much more sane way.
I hope this at least explains why it is like it is. I'm happy to make changes to support the new API and make things more streamlined.
from unfurl.
I think the PR looks good 👍
from unfurl.
Great, thanks for the feedback, I'll keep working on it in this direction
from unfurl.
Related Issues (20)
- Evaluate newest Flask version for use HOT 3
- twitter snowflake is not parsed on twitter subdomains
- Twitter parser - full list for the sharing code parameter HOT 1
- FR: Refactor `data_types` for timestamps to be better for filtering
- FR: Show ancestry of a given node
- Update Mastodon edge colors/icon HOT 1
- Receiving this error for both Offline Server and CLI tools HOT 4
- LinkedIn Link Shortener doesn't expand
- Evaluate replacing embedded blackboxprotobuf with PyPI version HOT 1
- UUID Version 6
- UUID Version 7
- UUID Version 8
- Timeflake
- "Signed URLs" from various services
- refactor code to separate API logic from core.py logic HOT 7
- protobuf dependency inquiry HOT 2
- Split out the requirements for Unfurl's web UI
- Default build error, with fix? HOT 2
- Consider integrating external regexes into Unfurl
- imp no longer exists in 3.12 HOT 4
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 unfurl.