-- Leo's gemini proxy

-- Connecting to gmi.bacardi55.io:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini; lang=en

Sharing public links from linkding to gotosocial with Feed2fedi and RSS Bridge

Posted on 2024-01-11


Yesterday, [I wrote about my blog BOT], running thanks to [feed2fedi]. Today, let's talk about my [links BOT] which, while running thanks to feed2fedi as well, was a lot more work to setup.


I save my bookmarks using [linkding]. It's a nice software where I saved all my bookmarks for potential future use. Earlier this year, I decided to share the most interesting one (and "closer" to my web presence, so nothing political for example). Linkding has a share feature, so creating a [public page with shared links] was as easy as checking a box.


The main issue is the lack of RSS feed for publicly shared links from linkding… Without an RSS feed, I had basically 3 options:

Wrote a program based on linkding API or existing library and push them to my Fediverse account. Easy and fun, but would have been very time consuming to develop, even based on existing library. Was my "plan Z" :).

Use my "private RSS feed" (a feature in linkding) to just share everything. Easy enough but there are some article I'm saving I'm not willing to share (most of them being French too).

Create an RSS feed on the fly. I heard about [RSS Bridge] before but never tried it. But I knew it could potentially work.


In the end, I tried the 3rd option (using RSS Bridge) first, and that worked, so I didn't look into the other roads. This solution might sound overkilled (and that would be true), but I often thought about using RSS Bridge, so now that I installed it for this use case, I'm hopping to find others too :).


I installed RSS Bridge on my homelab, but as for sengi (Fediverse web client), I limited its access to only my private network. I'm not comfortable with other people using it for unknown site… At least not a version hosted at home. I'm not going to talk about its installation, the [documentation] should be enough. I didn't want to waste time with manual setup for this tool, so I used the provided docker image this time out of laziness…


The interesting part was finding the right way to extract wanted data to be put in the generated RSS feed. I tried at the first the "CSS Selector Bridge", but it was to complicated to extract what I wanted without too much noise with it. I then tried XPathBridge. I was not very familiar with [XPath], it was straightforward.


You can see [my public shared links page], but in a nutshell, each bookmark entry looked like this:


<li class="shared" ld-bookmark-item="">
    <label ld-bulk-edit-checkbox="" class="form-checkbox">
        <input type="checkbox" name="bookmark_id" value="144">
        <i class="form-icon"></i>
    </label>
    <div class="title">
        <a href="https://www.bortzmeyer.org/mon-serveur-messagerie.html" target="_blank" rel="noopener">
        Gestion de son serveur de courrier électronique | Bortzmeyer
        </a>
    </div>
    <div class="description truncate">
        <span>
            <a href="?q=%23selfhosting">#selfhosting</a>
            <a href="?q=%23email">#email</a>
            <a href="?q=%23french">#french</a>
        </span>
    </div>
    <div class="actions text-gray text-sm">
        <span>Today</span>
        <span class="separator">|</span>
        <span>Shared by
            <a href="?user=bacardi55">bacardi55</a>
        </span>
    </div>
</li>

So my configuration of the XPath bridge was as follow:


Enter web page URL: https://links.bacardi55.io/bookmarks/shared

Item selector: ~//ul[@class="bookmark-list"]/li~

Item title selector: ~./div[@class="title"]/a/text()~

Item description selector: ~./div[@class="description truncate"]/span[1]~

Item URL selector: ~./div[@class="title"]/a/@href~

Item author selector: ~./div[@class="actions text-gray text-sm"]/span[3]/a/text()~


Then RSS Bridge is giving a link for an atom feed that I used in feed2fedi configuration. For more information on configuring feed2fedi, either read my previous entry or the official documentation :).



I wrote about my blog BOT

feed2fedi

links BOT

linkding

public page with shared links

RSS Bridge

documentation

XPath

my public shared links page



/gemlog/


Send me a gemini mention

send me an email!

-- Response ended

-- Page fetched on Tue May 21 03:00:03 2024