
Reading Livejournal.com sub-entries in Google Reader
Before Google Reader, I actively read a friend feed at Livejournal.com. And then habr appeared. And then a bunch of interesting standalone blogs.
Gradually, greader became the main tool for reading news. And with the opening of Yahoo Pipes, the quality of my feeds has increased significantly.
Pipes allowed me to filter out several feeds only for topics that interest me, allowed me to fill out the description field in those feeds where for some reason the authors did not fill them out (news from the IRN.ru website, the Computerra feed), and much more.
But there was a fly in the ointment and a fly in the ointment. Neither Pipes nor Google Reader can do digest authentication. Pipes can only basic, greader does not. And digest is the only authentication type that Livejournal.com supports.
Therefore, attempts to log in to LJ and read tapes with sub-lock entries were doomed to failure.
I had to periodically go into the tape and see if any of my friends wrote anything “under lock and key”.
Yes, there are services on the Internet a la
solving this problem, but do you trust anyone with a login and password from your LiveJournal on the Internet? And how to integrate this service with pipes I could not come up with. But there is no silver lining: the author revealed the source code of the scripts. Armed with patience and a manual on php, based on the freemyfeed sources, I wrote my own script - remove-authentication.php, which does one simple thing: replaces digest authentication with basic.
With it, designs become possible:
And this thing integrates wonderfully with pipes.
Whoever needs it, take it. And read LiveJournal in Google Reader. )
UPD: the code should be saved as remove-authentication.php and laid out on any server that supports php :) Ideally, your own.
UPD2: moved to RSS blog
PS: this is my first php code, constructive criticism is welcome :)
Gradually, greader became the main tool for reading news. And with the opening of Yahoo Pipes, the quality of my feeds has increased significantly.
Pipes allowed me to filter out several feeds only for topics that interest me, allowed me to fill out the description field in those feeds where for some reason the authors did not fill them out (news from the IRN.ru website, the Computerra feed), and much more.
But there was a fly in the ointment and a fly in the ointment. Neither Pipes nor Google Reader can do digest authentication. Pipes can only basic, greader does not. And digest is the only authentication type that Livejournal.com supports.
Therefore, attempts to log in to LJ and read tapes with sub-lock entries were doomed to failure.
I had to periodically go into the tape and see if any of my friends wrote anything “under lock and key”.
Yes, there are services on the Internet a la
http://freemyfeed.com,
solving this problem, but do you trust anyone with a login and password from your LiveJournal on the Internet? And how to integrate this service with pipes I could not come up with. But there is no silver lining: the author revealed the source code of the scripts. Armed with patience and a manual on php, based on the freemyfeed sources, I wrote my own script - remove-authentication.php, which does one simple thing: replaces digest authentication with basic.
With it, designs become possible:
http: // user: pass@my.server/remove-authentication.php? feed = feed-url
And this thing integrates wonderfully with pipes.
Whoever needs it, take it. And read LiveJournal in Google Reader. )
UPD: the code should be saved as remove-authentication.php and laid out on any server that supports php :) Ideally, your own.
UPD2: moved to RSS blog
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="My Realm"');
header('HTTP/1.0 401 Unauthorized');
echo 'Формат запроса - USER:PASS@SERVER.RU/remove-authentication.php?feed=FEED-URL';
exit;
} else {
if (isset ($_GET['feed'])) {
header("Content-Type: text/html; charset=utf-8");
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $_GET['feed'] .'?auth=digest');
curl_setopt($ch, CURLOPT_AUTOREFERER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
curl_setopt($ch, CURLOPT_USERPWD,strtolower($_SERVER['PHP_AUTH_USER'] . ':' . $_SERVER['PHP_AUTH_PW']));
$data = curl_exec($ch);
curl_close($ch);
} else {
echo 'Формат запроса - USER:PASS@SERVER.RU/remove-authentication.php?feed=FEED-URL';
exit;
}
}
?>
* This source code was highlighted with Source Code Highlighter.
PS: this is my first php code, constructive criticism is welcome :)