Athou / commafeed

Google Reader inspired self-hosted personal RSS reader.
https://www.commafeed.com
Apache License 2.0
2.82k stars 377 forks source link

Allow filtering of body content somehow #1494

Closed treetip closed 2 months ago

treetip commented 4 months ago

Is your feature request related to a problem? Please describe. I upgraded from a really old version where youtube rss feeds had no body content (no idea why).

In latest version the body contains the thumbnail image and the description of the video.

Descriptions on youtube these days are just 100% spam, and makes browsing youtube feeds really annoying in the latest version.

Describe the solution you'd like Add non css module classes for the different parts of the content so they can be easily hidden.

Or maybe a youtube specific filter to not even store the descriptions optionally?

Describe alternatives you've considered Can't think of anything else, maybe allowing to use what ever made the really old versions not even store any body content for youtube feeds.

Additional context On a 1440p height browser (viewport slight smaller), even a "reasonable" description from tested takes the entire vertical space:

image

Athou commented 4 months ago

Editing feeds is a little bit out of scope for CommaFeed at the moment. Looks like RSSHub is doing exactly what you want with YouTube feeds though.

Crul commented 4 months ago

Describe alternatives you've considered Can't think of anything else,

@treetip With browser plugins like Tampermonkey, you can filter entries on the client side. See this example:

function initXhrInterceptor() {
  (function(open) {
      function XhrOpenWrapper(verb, url) {
          if (url.startsWith("./rest/category/entries")
              || url.startsWith("./rest/feed/entries")) {
              this.addEventListener("readystatechange", handleEntriesLoaded, false);
          }
          open.apply(this, arguments);
      }
      window.XMLHttpRequest.prototype.open = XhrOpenWrapper;
  })(window.XMLHttpRequest.prototype.open);
}

function handleEntriesLoaded(e) {
    if (this.readyState !== 4 || !this.response)
        return;

    try {
        processEntries(this);
    } catch(e) {
        console.debug(e);
        console.debug(this.response);
    }
}

function processEntries(xhr) {
    let data = JSON.parse(xhr.response);
    if (data.entries && data.entries.map) {
        data.entries = data.entries.map(processEntry);
        let dataText = JSON.stringify(data);
        // Override the response text.
        Object.defineProperty(xhr, "responseText", {
            get() { return dataText; },
        });
        Object.defineProperty(xhr, "response", {
            get() { return dataText; },
        });
    }
}

function processEntry(entry) {
    if (entry.feedUrl.startsWith("https://www.youtube.com")) {
        entry.content = "&nbsp";
    }
    return entry;
}

initXhrInterceptor();