Skip to content

Support more formats and protocols #14

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

Open
sjehuda opened this issue Oct 30, 2024 · 5 comments
Open

Support more formats and protocols #14

sjehuda opened this issue Oct 30, 2024 · 5 comments

Comments

@sjehuda
Copy link

sjehuda commented Oct 30, 2024

I suggest to engineer NewsAgain for multiple protocols.

Protocols

  • ActivityPub
  • FTP
  • Gemini (Gem Text, Gemini Feed)
  • Gopher
  • HTTP
  • Nostr
  • OStatus (GNU Social, StatusNet)
  • twtxt
  • XMPP

gemini://woodpeckersnest.space/~schapps/journal/2024-08-02-good-news-friday-a-new-dawn-of-syndications.gmi

Gemini and Gopher

  • Gemini and Gopher can convey XML files.
  • There is also a format that is called Gemini feed format which is supported by Lagrange.

Jabber/XMPP

You can also refer to people of the Berlin XMPP Meetup.


I do not want to communicate the considerations here, yet.

I would be delightful for us to converse over a VoIP session on SIP or XMPP, whichever you want.

It should not require more than 5 minutes for me to explain it.


A NEW MESSAGE

I have created an XMPP gateway for HTTP.
I encourage you to view the video demonstration (length 7:44).

https://video.xmpp-it.net/w/vNqcMooy3pqRAZ8Yb8grr1
https://git.xmpp-it.net/sch/Rivista


I am not sure why I have wrote this line I have created a News Bot for XMPP, and even though it currently supports only XMPP, it is structured to add more protocols (e.g. Email, IRC etc.). See https://git.xmpp-it.net/sch/Slixfeed

@sjehuda sjehuda changed the title Multi protocol Support multiple protocols Oct 30, 2024
@sjehuda sjehuda changed the title Support multiple protocols Support more formats and protocols Apr 15, 2025
@sjehuda
Copy link
Author

sjehuda commented Apr 15, 2025

I have added twtxt to the list.

I have wrote this code to parse twtxt.

function renderTwtxt(txtFile) {
 
  let lines = txtFile.trim().split('\n');
 
  let metadata = {};
 
  for (const line of lines) {
    if (line.startsWith('#') && line.includes('=')) {
      let newLine = line.replace('#','');
      let keyValue = newLine.split('=');
      let key = keyValue[0].trim();
      let value = keyValue[1].trim();
      metadata[key] = value;
    }
  }
 
  let newDocument = createPage();
 
  newDocument.title = metadata['nick'];
 
  if (metadata['lang']) {
    newDocument
    .documentElement
    .setAttribute('lang', metadata['lang']);
  }
 
  let feed = newDocument.createElement('div');
  feed.id = 'feed';
 
  let title = newDocument.createElement('h1');
  if (metadata['nick']) {
    title.textContent = metadata['nick'];
  } else {
    title.textContent = document.location.hostname;
  }
  title.id = 'title';
  feed.append(title);
 
  let subtitle = newDocument.createElement('h2');
  if (metadata['description']) {
    subtitle.textContent = metadata['description'];
  } else {
    subtitle.textContent = defaultSubtitle;
  }
  subtitle.id = 'subtitle';
  feed.append(subtitle);
 
  if (enableIcon) {
    let iconPath = metadata['avatar'];
    if (iconPath) {
      let div = newDocument.createElement('div');
      let logoLink = newDocument.createElement('a');
      let logoImage = newDocument.createElement('img');
      logoLink.className = 'homepage-link';
      logoLink.id = 'logo';
      logoImage.src = metadata['avatar'];
      logoLink.append(logoImage);
      div.append(logoLink);
      feed.append(div);
    }
  }
 
  let toc = newDocument.createElement('ol');
  toc.id = 'toc';
  feed.append(toc);
 
  let articles = newDocument.createElement('div');
  articles.id = 'articles';
  feed.append(articles);
 
  for (const line of lines.reverse()) {
    if (!line.startsWith('#')) {
      let twtEntry = line.split('	');
      let timestamp = twtEntry[0];
      let message = twtEntry[1];
      let items = lines.length;
      let index = lines.indexOf(line) + 1;
      let titleToc = newDocument.createElement('a');
 
      let dateAsTitle = new Date(timestamp);
      titleToc.textContent = dateAsTitle;
      titleToc.href = `#newspaper-oujs-${index}`;
      titleToc.title = titleToc.textContent;
      let liElement = newDocument.createElement('li');
      liElement.append(titleToc)
      toc.append(liElement);
 
      let entry = newDocument.createElement('div');
      entry.className = 'entry';
 
      let link = newDocument.createElement('a');
      link.textContent = dateAsTitle;
      link.href = '';
      link.id = `newspaper-oujs-${index}`;
 
      title = newDocument.createElement('h3');
      title.className = 'title';
      title.append(link);
      entry.append(title);
 
      let date = newDocument.createElement('div');
      date.className = 'published';
      date.textContent = dateAsTitle;
      entry.append(date);
 
      let text = newDocument.createElement('div');
      text.className = 'content';
      text.textContent = message;
      entry.append(text);
 
      articles.append(entry);
 
      if (
        index > minimumItemNumber &&
        index < items &&
        !ignoreMinimumItemNumber
          )
      {
        let titleToc = newDocument.createElement('a');
        titleToc.textContent = 'See all posts >';
        titleToc.title = `This feed offers ${items} items`;
        titleToc.className = 'expand';
        toc.append(titleToc);
        articles.append(titleToc.cloneNode(true));
        break;
      }
    }
  }
 
  newDocument.body.append(feed);
  newDocument = checkContentEmptiness(newDocument);
  return newDocument;
}

https://greasyfork.org/en/scripts/465932-newspaper-syndication-feed-reader

@sjehuda
Copy link
Author

sjehuda commented Apr 15, 2025

@SeveFP
Are you interested to collaborate with NewsAgain, and incorporate support for XMPP?

@lwindolf
This is the XMPP news reader of Seve https://github.com/SeveFP/Reeder

@lwindolf
Copy link
Owner

At the moment I don't want to support such a variety of formats and protocols.

@sjehuda
Copy link
Author

sjehuda commented Apr 16, 2025

Fair.

Perhaps we should create a plugin, if the plugin system of NewsAgain would allow it.

Of note

I suppose that adding support for XMPP would cause to NewsAgain nto feature at https://xmpp.org/software/

So it would be for Nostr.

I am not usre for the rest.

Post script

I am working on a news bot for XMPP, which currently supports HTTP, yet I intend to add support for various of other protocols and formats, and I will inform you of my progress, especially if I am to visit Germany!

@lwindolf
Copy link
Owner

Yes, I intend to provide a plugin system (more our less ad-hoc loading extra JS). But this will take a while. As with Liferea I plan to implement "sources" (like TTRSS, TheOldReader...) as plugins to encourage implementing more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants