LJ LFs

Apr. 8th, 2017 03:48 pm
codeswitcher: A rainbow splash of paint exploding upward (Default)
[personal profile] codeswitcher
WTELF. I am trying to – yes, yes, I know – do regexes on dumps of the LJ Inbox, and I just discovered that something Very Weird is going on with the linefeeds.

Mostly everything is fine. Except the part that isn't: The actual message contents seem to have line breaks between, er, lines (at least everything that renders that thinks they're line ends – View Source in Firefox, more at the command line, BBEdit) except that perl isn't seeing them as line breaks. Perl thinks (okay, while (my $line = <INBOXFILE>) returns) they're all one big happy line with some sort of line break in them. Running against that string regex that matches just the HTML at the end ($line =~ /<div class=\'actions\'>/) doesn't just return the last line of the message, it returns almost the whole damned message.

To confirm this, I wrote a perl script to simply number the lines of the raw HTML. It returned something like the following (heavily redacted because privacy and not escaping all the damned angle brackets):
[...]

522:                 <td class="item">

523:                     <div class="InboxItem_Controls"><a href='http://www.livejournal.com/inbox/?page=1&bookmark_off=3320'><img src='../../l-stat.livejournal.net/img/flag_off.gif' width='16' height='18' class='InboxItem_Bookmark' border='0' /></a> 

524:                 <a href="http://www.livejournal.com/inbox/?page=1&expand=3320"><img src="../../l-stat.livejournal.net/img/expand.gif%3Fv=8234" class="InboxItem_Expand" border="0" onclick="return false" /></a>

525:                 </div>

526:                     <span class="InboxItem_Title InboxItem_Unread" id="all_Title_3320"><div class='pkg'><div style='width: 60px; float: left;'><img src="../../l-userpic.livejournal.com/19583817/961489" width="50" align="top" /></div><div>Re: (no subject)<br />from HTMLHTMLHTML...

527:                     

528:                 <div class="InboxItem_Content" style="display: block;">Yes, exactly that one!  Thank you so much.  blah blah blah it's an awesome post, and I'm so glad you helped me find it again.
<br />
<br />randomusername
<br />
<br />--- I wrote:
<br />> This one? URLgoeshere
<br />> <br />> --- randomuername wrote:
<br />> > Sorry for bothering you, but was it you that wrote the awesome post about the blah blah blah?  I can't find it despite googling a lot, so I thought I'd ask... <div class='actions'> <a href='http://www.livejournal.com/inbox/compose.bml?mode=reply&msgid=80595787'>Reply</a> | <a href='http://www.livejournal.com/friends/add.bml?user=randomusername'>Add as friend</a> | <a href='http://www.livejournal.com/inbox/markspam.bml?msgid=80595787' class='mark-spam'>Mark as Spam</a></div></div>

529:                 

530:                     </td>

[...]

What I think should happen is that only the "line" that starts <br />> > Sorry for bothering you etc should be returned by matching on the attribute of that tag at the end. What I'm getting is everything here marked 528 and in bold.

As always, the questions are:

1) Why is it doing this to me? (Is there something actually different about those linefeeds? My text editor seems to think they're identical.)
2) What is doing this to me? (Is this perl being weird?)
3) How do I make it stop? (Can I convince perl not to do what it's doing and do something that make more sense?)

Advice welcome. Meanwhile, I'm necessarily just going to live with it. Don't have time to wrestle this alligator on my way across the swamp.
codeswitcher: A rainbow splash of paint exploding upward (Default)
[personal profile] codeswitcher
Does two things:

1) Removes the ToS modal overlay.

2) Unfolds all Inbox messages.

Enjoy...
// ==UserScript==
// @name        Codeswitcher's LJ ToS-Boss
// @namespace   http://livejournal.com
// @description FU SUP
// @include     http://*.livejournal.com/*
// @include     http://*.livejournal.com
// @version     2
// @grant       none
// ==/UserScript==

window.onload = function () {
  document.body.setAttribute("class","s-horizon logged-in");   
  var hackthisStylesheet = document.styleSheets[document.styleSheets.length - 1 ];
  hackthisStylesheet.insertRule(".InboxItem_Content { display: block !important; }", 0); 
 }
codeswitcher: A rainbow splash of paint exploding upward (Default)
[personal profile] codeswitcher
So, I just discovered you can replace (I mean manually) the href="javascript:void(0);" in the a tags with actual GET strings to, e.g. Twitter's sharing doohicky, HOWEVER,

while

https://twitter.com/intent/tweet?url=http%3A%2F%2Fcodeswitcher.dreamwidth.com%2F131.html%3Futm_source%3Dtwsharing%26utm_medium%3Dsocial&text=Post%20Idea&;

Is fine

https://twitter.com/intent/tweet?url=http%3A%2F%2Fcodeswitcher.dreamwidth.com%2F131.html%3Futm_source%3Dtwsharing%26utm_medium%3Dsocial&text=Post%20Idea&hashtags=LJ,programming

instead triggers LJ's javascript pop-up sharing thingy, for no obvious reason, and does not actually follow that link on clicking.

https://twitter.com/intent/tweet?url=http%3A%2F%2Fcodeswitcher.dreamwidth.com%2F131.html%3Futm_source%3Dtwsharing%26utm_medium%3Dsocial&text=Post%20Idea&hashtags=

Does the javascript thing, too.

Huh. The trigger seems to be the word "hashtags"? How bizarre.

Fortunately, that's an undesirable feature anyway, so good riddance.
codeswitcher: A rainbow splash of paint exploding upward (Default)
[personal profile] codeswitcher
I wrote some scripts to automate the granting of access filter privileges in Dreamwidth, for recent importees from Livejournal.

They're in perl, and use wget, and are for the command line, and require that you figure out how to come up with a cookie file.

Instructions in the README.md

They are here on Github.

There are many improvements that could be made, but I think I should move on to trying to address some of the other outstanding importation problems.

I so clearly have no idea how to use github. Suggestions of every sort are welcome, including just which license I should release this under.
[identity profile] codeswitcher.livejournal.com
LJFilterRescue is a Greasemonkey userscript. LJFilterRescue is available for download on userscripts.org.

What it does

Lists your fgroups (filters) and their members at the bottom of your "Manage Custom Friends Group" page in text for ease of cutting-and-pasting.

Why

You back up your journal, right? Do you back up your filters? If LJ were down indefinitely, would you know who you put on which filter, so you could reconstitute your filters somewhere else?

Because LJs only filter management tools are form controls, there's no way to get a simple textual list of your filters and who's in 'em. Until now.

Requirements

Firefox
The Greasemonkey add-on for Firefox.
This userscript.

Profile

cs_hackerary: (Default)
Codeswitcher's Hackerary

March 2022

S M T W T F S
  12345
6 789101112
13141516171819
20212223242526
2728293031  

Syndicate

RSS Atom

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jun. 9th, 2025 10:43 am
Powered by Dreamwidth Studios