Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I provide an extended export ? #1450

Open
Riduidel opened this issue Apr 29, 2020 · 11 comments
Open

How can I provide an extended export ? #1450

Riduidel opened this issue Apr 29, 2020 · 11 comments
Labels
3rd party interoperability with third-party platforms API REST API feature

Comments

@Riduidel
Copy link

Current export format doesn't include the shaare permalink, neither the image.
I would like to have those infos in my export.

I was envisionning creating a plugin, but it seems like a plugin can't provide a new route, so I won't be able to have a new export route. So, what could I do to have such an extended export available without sacrifying the standard shaarli export ?

@nodiscc
Copy link
Member

nodiscc commented May 1, 2020

I don't think the "Netscape"-style HTML bookmarks format provides a way to show such information (actually I don't think there is a specification at all). Can you give an example snippet of what you would expect inside the HTML export?

@nodiscc nodiscc added the feature label May 1, 2020
@nodiscc nodiscc added this to the backlog to the future milestone May 1, 2020
@Riduidel
Copy link
Author

Riduidel commented May 1, 2020 via email

@Riduidel
Copy link
Author

Riduidel commented May 5, 2020

So here is what I did

I changed the export.bookmarks.tpl file to

<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<!-- This is an automatically generated file.
     It will be read and overwritten.
     Do Not Edit! -->{ignore}The RainTPL loop is formatted to avoid generating extra newlines{/ignore}
<TITLE>{$pagetitle}</TITLE>
<H1>Shaarli export of {$selection} bookmarks on {$date}</H1>
<DL><p>{loop="links"}
<DT><A HREF="{$value.url}" ADD_DATE="{$value.timestamp}" PRIVATE="{$value.private}" TAGS="{$value.taglist}">{$value.title}</A>{if="$value.description"}{$eol}
<DD>
{$value.description}
<A HREF="?{$value.shorturl}">
<IMG SRC="{$value.thumbnail}"/>
</A>
{/if}{/loop}
</DL><p>

(notice I added the link and image after description, to minimize bad rendering if using import to import in a browser).

This way, my export contains everything I need ... but it's obviously only a hack.

@nodiscc
Copy link
Member

nodiscc commented May 10, 2020

So you add the permalink and thumbnail in the description field? Why not - it may be useful and doesn't break anything. I think we could provide an option/checkbox in the export dialog Embed permalink and thumbnail in descriptions?

@nodiscc nodiscc added easy good place to start contributing 3rd party interoperability with third-party platforms template HTML rendering labels May 10, 2020
@Riduidel
Copy link
Author

Sorry for the late reply, I will work on it and provide a PR soon

Riduidel added a commit to Riduidel/Shaarli that referenced this issue May 19, 2020
THis provides a richer export, incompatible with old browsers, but allowing nicer integration mechanisms into other systems.
I typically gonna use that to generate a lifestream including my Shaarli content.
@nodiscc
Copy link
Member

nodiscc commented Sep 12, 2020

Pull Request at #1470

@ArthurHoaro
Copy link
Member

ArthurHoaro commented Sep 12, 2020

It's my bad, I didn't review the latest changes and since it has no milestone, never came back to it.

EDIT: putting it to v0.12.1.

@ArthurHoaro ArthurHoaro modified the milestones: 0.12.1, 0.12.2 Nov 3, 2020
@ArthurHoaro
Copy link
Member

I ran a few tests and I don't think it's a good idea to extend the netscape format with some additional <A> field: it doesn't work well when it's imported back into Shaarli, it doesn't work when it's imported into a browser. So it kinf of defeat the purpose of exporting the bookmarks into this format.

I suggest that, instead, we close this, and we explore more in depth a way to export the entire DB into an easier format to use programmatically, such as #1823. Any thought?

@nodiscc
Copy link
Member

nodiscc commented Aug 29, 2022

I agree that HTML exports should stick to the basic netscape format as much as possible. Full JSON exports are already possible using the API. Maybe we should work on a pure PHP export functionality which doesn't require third-party API clients? Using curl is another option, but not straightforward as it requires fetching and reusing a JWT token.

@virtadpt
Copy link

It would certainly be handy, @nodiscc.

@nodiscc nodiscc added API REST API and removed easy good place to start contributing template HTML rendering labels Sep 4, 2022
@nodiscc nodiscc modified the milestones: 0.12.2, backlog to the future Sep 4, 2022
@Lucas-C
Copy link

Lucas-C commented Dec 4, 2023

Maybe we should work on a pure PHP export functionality which doesn't require third-party API clients?

I have just submitted a PR that could be of interest to you: #2053

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3rd party interoperability with third-party platforms API REST API feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants