Open Sisyphuss opened 9 years ago
Well, that link doesn't resolve to a notebook, but rather a download page. That's not going to work.
Pulling the URL that actually gets generated from the download (actually annoying to get, as it is all javascripty, but at least stable) yields:
And feeding that into the front page of nbviewer, we get the nbviewer URL: http://nbviewer.ipython.org/urls/doc-00-ag-docs.googleusercontent.com/docs/securesc/ha0ro937gcuc7l7deffksulhg5h7mbp1/l058tmm4stdqdjhe1hs0t564snj08ahm/1426680000000/09083926091300078733/*/0B30Cah_MN0i0TlZfRlBXLWgxbE
we are getting a 403: forbidden from the upstream provider.
Checking this with curl:
curl "https://doc-00-ag-docs.googleusercontent.com/docs/securesc/ha0ro937gcuc7l7deffksulhg5h7mbp1/l058tmm4stdqdjhe1hs0t564snj08ahm/1426680000000/09083926091300078733/*/0B30Cah_MN0i0TlZfRlBXLWgxbE0?e=download"
Shows the URL will actually reply, but just not to nbviewer.ipython.org.
So basically, we would either need:
The provider option seems like a good idea, along with #371 (gitlab), #302 (webgit), and #402 (stash/bitbucket). I've included this in #428!
Google Drive has worked for me in the past using the web host feature: https://support.google.com/drive/answer/2881970?hl=en
You just need to extract the document id from the sharing link and use this address instead: www.googledrive.com/host/[doc id]
Example: your sharing link https://drive.google.com/open?id=0BxSDFsdFDFTVU results in www.googledrive.com/host/0BxSDFsdFDFTVU
For some reason however, this doesn't work any more. I'm getting the error "Error reading JSON notebook" . I think the notebook I tested should work (works in ipython), but I'll try again with another one soon.
None of those links appear to work, asking me to authenticate: try it in a private browsing. Likely, nbviewer is getting back the HTML for the login page.
Additionally, even if we did allow this, we would get throttled... one HN post to something on GD, and poof! everyone's stuff becomes unreachable.
API-level integration is really the only path that makes any sense in the long run vs google: they can (and have) changed their user URLs at any time, whereas the APIs stay stable for at least a while, and they have a fairly manageable sunset period between versions.
On Mon, Jul 27, 2015 at 1:00 PM dominikandreas notifications@github.com wrote:
Google Drive has worked for me in the past using the web host feature: https://support.google.com/drive/answer/2881970?hl=en
You just need to extract the document id from the sharing link and use this address instead: www.googledrive.com/host/[doc http://www.googledrive.com/host/%5Bdoc id]
Example: your sharing link https://drive.google.com/open?id=0BxSDFsdFDFTVU results in www.googledrive.com/host/0BxSDFsdFDFTVU
For some reason however, this doesn't work any more. I'm getting the error "Error reading JSON notebook" . I think the notebook I tested should work (works in ipython), but I'll try again with another one soon.
— Reply to this email directly or view it on GitHub https://github.com/jupyter/nbviewer/issues/427#issuecomment-125271986.
Those links were just an example (i made up the id). The webpage hosting feature of google drive should work though, it's made for static file serving. If nbviewer would catch the doc id from the sharing link and use the www.googledrive.com/host/[doc id] link instead, it shouldn't be a problem.
On the other hand, API-level integration is probably still the better way to go
Those links were just an example (i made up the id).
Tricky! I guess i was being too sneaky before.
here's the original julia notebook uploaded to my drive and set to share with world... preliminary effort suggests that setting it to the equivalent of a secret gist (i.e. no auth required, but not searchable) has no effect.
We could do something like this knock-off of the dropbox "provider":
# ./providers/gdrive/handlers.py
def uri_rewrites(rewrites=[]):
return rewrites + [
(r'^https://drive.google.com/file/d/([^/]*)/.*$',
u'/urls/googledrive.com/host/{1}'),
(r'^https://drive.google.com/open?id=([^&]*)$',
u'/urls/googledrive.com/host/{1}'
]
Those two url patterns come through different techniques, both user accessible, but are different enough to not fit in one pattern.
I can guarantee that relative file links won't work: drive barely has directories as it is, but if people thought even this level of integration was useful, I wouldn't be against adding it...
I agree that we should use stable API. As an occasional user of Google Drive, I noticed that Google constantly changes its interface to improve user experience.
Is there any update on this one? We have google drive at work and I want to share notebooks inside the organization using a in-house hosted nbviewer.... It doesn't work at the moment.
Glad to here you are able to use nbviewer internally! We're always interested in feedback from other operators :)
I'm actually in the same boat: it would be lovely to share our private stuff on a local nbviewer.
For non-public drive content, one would have to build out a full API provider, with the server having its own API key able to see everything your google drive organization. The initial hack proposed would have just gotten the globally-viewable stuff.
Unfortunately, features that won't be used on nbviewer.*.org are likely not going to end up getting prioritized, but we do have an extension mechanism for providers that would allow an exension, i.e. nbviewer-gdrive
, to be developed and used with nbviewer. Looks like there is now a v3 of the google REST API that would be a good target. We'd be happy to provide support to anyone that would like to embark on this journey!
Nbviewer failed to render a valid Julia notebook: https://drive.google.com/file/d/0B30Cah_MN0i0TlZfRlBXLWgxbE0/view?usp=sharing stored in Google Driver.