Save article in Readability Plugin

Post plugins and custom CSS snippets here
User avatar
ebell451
Bear Rating Trainee
Bear Rating Trainee
Posts: 44
Joined: 15 Mar 2013, 15:06
Contact:

Save article in Readability Plugin

Postby ebell451 » 30 Mar 2013, 11:26

Here is a plugin that will allow you to save an article to Readability: https://github.com/ebell451/tt-rss_plugin_readabillity

This was requested in: viewtopic.php?t=1598&p=7443#p7443
Last edited by ebell451 on 30 Mar 2013, 11:53, edited 1 time in total.

User avatar
fox
^ me reading your posts ^
Posts: 6318
Joined: 27 Aug 2005, 22:53
Location: Saint-Petersburg, Russia
Contact:

Re: Save article in Readability

Postby fox » 30 Mar 2013, 11:28

I'll add this to the wiki index

re4med
Bear Rating Trainee
Bear Rating Trainee
Posts: 13
Joined: 30 Mar 2013, 05:40

Re: Save article in Readability Plugin

Postby re4med » 30 Mar 2013, 13:13

Thanks for posting that. It works very well except for one cosmetic issue. When I save an article to my Readability account it states:

Save this article for reading later?
This article is already in your Reading List. Saving it again will unarchive it, if it has been archived.


...even when it is NOT on my reading list. This is not an issue, necessarily, as it does save it fine when I proceed. As I said, simply a cosmetic thing.

Thanks,

Wm. Hill

step21
Bear Rating Trainee
Bear Rating Trainee
Posts: 2
Joined: 30 Mar 2013, 17:12

Re: Save article in Readability Plugin

Postby step21 » 30 Mar 2013, 17:15

What would be even nicer imho - selfoss has the ability to generate full feeds from truncated feeds using the readability api.
https://github.com/SSilence/selfoss/blo ... bility.php

I couldn't test it because selfoss itself doesn't run for me. Doesn't look too complicated I think, though I'm not really sure where to implement it/not sure if I have the time to look into it.

User avatar
ebell451
Bear Rating Trainee
Bear Rating Trainee
Posts: 44
Joined: 15 Mar 2013, 15:06
Contact:

Re: Save article in Readability Plugin

Postby ebell451 » 30 Mar 2013, 22:11

re4med: This has to do with your cookies. The bottom of the window tells you this, "Seeing this page every time you Read Later? Be sure you're accepting cookies from http://www.readability.com. Learn more »".

step21: I was trying to stay away from having to pull an API key from Readability. The Readability - Mobile pulls full text; however, it does remove media from the article. Readability has a Read Now option; however, I did not create a Plugin based on that...only the Read Later and Mobile.
Last edited by ebell451 on 30 Mar 2013, 22:32, edited 1 time in total.

step21
Bear Rating Trainee
Bear Rating Trainee
Posts: 2
Joined: 30 Mar 2013, 17:12

Re: Save article in Readability Plugin

Postby step21 » 30 Mar 2013, 22:32

@ebell451 I got that/know that it's a different thing. However for the 'reading list' I have all my stuff in readitlater/pocket or evernote already. The functionality with the api key as described for selfoss sounded interesting, though as I stated, no idea how nice it would actually be without having been able to test it. I tried hacking something together, but so far the only result was that my plugin list is empty :(

taufi
Bear Rating Trainee
Bear Rating Trainee
Posts: 1
Joined: 09 Apr 2013, 23:48

Re: Save article in Readability Plugin

Postby taufi » 10 Apr 2013, 00:08

Hey guys, I have a request for readability plugin as well:). Plugin which would save readability output to the article content. I'm not a programmer but I managed to edit rssfuncs.php so it works somehow, but plugin would be much better.

How I did it. Signed to readability, requested access to API (you get token you can use to access the API).
I updated function update_rss_feed, replaced

Code: Select all

$entry_content = $item->get_content();
for

Code: Select all

$entry_content = readabilitize($entry_link);


And added fuctions

Code: Select all

function readabilitize($link) {
   $urlpart1="https://readability.com/api/content/v1/parser?url=";
   $urlpart2="&token=[my token to readability API]";
   $readaburl=$urlpart1.$link.$urlpart2;

   $str = file_get_contents($readaburl);
   $response = array();
   $response = parse_http_response($str);
   $readiblitizecontent = $response['0'];
   $readiblitizecontent=stripcslashes(substr_replace(substr((string)$readiblitizecontent['"content"'], 1),"",-2));
   return $readiblitizecontent;
}   
   
   
function get_url_contents($url){
    $crl = curl_init();
    $timeout = 5;
    curl_setopt ($crl, CURLOPT_URL,$url);
    curl_setopt ($crl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt ($crl, CURLOPT_CONNECTTIMEOUT, $timeout);
    $ret = curl_exec($crl);
    curl_close($crl);
    return $ret;
}

function parse_http_response ($string)
    {
     
    $headers = array();
    $content = '';
    $str = strtok($string, "\n");
    $h = null;
    while ($str !== false) {
    if ($h and trim($str) === '') {
    $h = false;
    continue;
    }
    if ($h !== false and false !== strpos($str, ':')) {
    $h = true;
    list($headername, $headervalue) = explode(':', trim($str), 2);
    $headername = strtolower($headername);
    $headervalue = ltrim($headervalue);
    if (isset($headers[$headername]))
    $headers[$headername] .= ',' . $headervalue;
    else
    $headers[$headername] = $headervalue;
    }
    if ($h === false) {
    $content .= $str."\n";
    }
    $str = strtok("\n");
    }
    return array($headers, trim($content));
    }


it must be coded terribly, but it works. Idea is simple. Call readability API (readability http with article link and your token), get http response with content, parse it, save it to article content. So if someone is able to create plugin for that,please do. It will be nice to have an option to turn it on/off for particular feeds.

re4med
Bear Rating Trainee
Bear Rating Trainee
Posts: 13
Joined: 30 Mar 2013, 05:40

Re: Save article in Readability Plugin

Postby re4med » 17 Apr 2013, 16:07

re4med: This has to do with your cookies. The bottom of the window tells you this, "Seeing this page every time you Read Later? Be sure you're accepting cookies from http://www.readability.com. Learn more »".


Not true. I am allowing cookies. It is not really a big deal since it still saves it correctly but the answer is not likely due to cookie permissions since I allow them.

RSS YOGI
Bear Rating Trainee
Bear Rating Trainee
Posts: 11
Joined: 22 Apr 2013, 14:24

Re: Save article in Readability Plugin

Postby RSS YOGI » 08 May 2013, 11:26

Hi Taufi,

And added fuctions


The functionality you write about sounds awesome. Am a beginner and have no idea about coding and stuff. Can you please explain more in detail as where the functions should be edited exactly. Not able to get this to work. Thanks for your help.

Bobjespat
Bear Rating Trainee
Bear Rating Trainee
Posts: 34
Joined: 15 Mar 2013, 11:43
Location: near Munich/Germany
Contact:

Re: Save article in Readability Plugin

Postby Bobjespat » 08 May 2013, 12:34

Tried it, but it seeams not to work. All what it does is, it loads a new Popup Window with URL: https://mydomain.de/tt_rss/backend.php? ... od=loading and a text "Ladevorgang, bitte warten... " in it. But there loads nothing... Do i something wrong?

User avatar
Strayer
Bear Rating Trainee
Bear Rating Trainee
Posts: 5
Joined: 13 May 2013, 02:11

Re: Save article in Readability Plugin

Postby Strayer » 13 May 2013, 02:15

I made some (read: lots of) changes to this plugin to inline the content of Readability using their parser API so I don't need to leave TT-RSS.

I'm not really satisfied with the result, I feel the parsed content doesn't look as nice as their own page for the content. Apart from that the implementation is rather basic, but it works. Hopefully.

Changed plugin can be found here: https://github.com/Strayer/tt-rss_plugi ... eadability

Bobjespat
Bear Rating Trainee
Bear Rating Trainee
Posts: 34
Joined: 15 Mar 2013, 11:43
Location: near Munich/Germany
Contact:

Re: Save article in Readability Plugin

Postby Bobjespat » 14 May 2013, 10:39

If i follow your Steps, i couldnt enable the Plugin, since i cant see it in the List of Plugins. The path is correct, rights are OK, and the Token is entered in init.php. Has this something to do with TT-RSS 1.7.9?

User avatar
Strayer
Bear Rating Trainee
Bear Rating Trainee
Posts: 5
Joined: 13 May 2013, 02:11

Re: Save article in Readability Plugin

Postby Strayer » 15 May 2013, 19:58

Oops, yes, I did revert a fix for 1.7.9 so I could work with my stable instance - I'm on the run now, but I'll commit a "blind" fix later!

User avatar
Strayer
Bear Rating Trainee
Bear Rating Trainee
Posts: 5
Joined: 13 May 2013, 02:11

Re: Save article in Readability Plugin

Postby Strayer » 16 May 2013, 02:27

Just reimplemented the changes for v1.7.9 - quick test worked for me, please check it out!


Return to “Themes and plugins”

Who is online

Users browsing this forum: No registered users and 1 guest