Install Theme

alberto-balsalm asked:

so i've noticed you've made contributions to pytumblr on github. would you be willing to put in a small pull request for me? just adding a couple of functions for tumblr API end points that aren't implemented in the python package. i use my github for professional stuff so I don't want anyone on github to know that I use tumblr

Yes, although I’d prefer to make the change to my pytumblr2 (post, github link) rather than trying to contribute to the official pytumblr.

I’ve tried the latter, and it wasn’t effective at getting the change onto PyPI and into the hands of users.

The official pytumblr is drastically of date at this point – it has zero NPF support and its model of the API hasn’t been updated with any of the changes since the introduction of NPF. At this point, it’s somewhere between “unusable” and “partially usable if you already know what you’re doing.”

(If you’re wondering about the notifications endpoint, I want to add that to pytumblr2 when I get time for it. The shitty-but-it-works notification-fetching code I actually use in my bot is here, fwiw.)

Over the last few days, I’ve done an extensive and long-needed refactor of @nostalgebraist-autoresponder’s codebase.

—-

Part of it was just organizing files into nice topical directories.

But the more exciting part is a complete redesign of how tumblr posts are converted into text!

The previous system had become a nightmare Rube Goldberg machine, much of which even I didn’t understand anymore.

I only started pulling posts in NPF recently, and until then, my code had no explicit data model of what a “tumblr post” was. I just got HTML, converted it into text, and then hacked on an increasingly long series of text translation layers as I wanted to make changes to the text format.

It was … it was bad. I’m talking, like, okay … here are some of the steps that every single post used to get shoved through on its way to GPT:

  1. this incomprehensible mess
  2. “substitute_forumlike”, aka Too Many Regexes™
  3. “v8” (??)

—-

But, thanks to NPF, I have a data model of tumblr posts!

So, if I need to mock up a modified version of a post, instead of writing it out in a weird internal text language and doing string processing, I can just do transformations to the NPF structure of the post itself, with no text involved.

At the very end, I call one (1) function that’s globally in charge of translating NPF -> text.

All of the logic in those garbage files linked above is now around 450 lines of code in two friendly-looking files.

I got to delete so much terrible code, you guys. Look at that commit. It felt good.

Somehow the pagination links (older, newer, page numbers) disappeared on my tumblr page at https://nostalgebraist.tumblr.com/

Looks like the website made them disappear because on some level it believes I have infinite scrolling turned on… but it didn’t go all the way and turn on infinite scrolling, so there was just no way to move through posts at all

I should file it as a bug (EDIT: done), but for now, posting this as a heads up in case it happens to you.

I fixed it for now by editing my theme to comment out the block that makes pagination invisible:

/*{block:IfInfiniteScroll}*/

/*#infscr-loading, .pagination {*/

/* display: none !important;*/

/*}*/

/*{/block:IfInfiniteScroll}*/

ajulian asked:

Fyi, frank or Tumblr appears to have a bug. Per this post: https://ajulian.tumblr.com/post/650718036140130304/frankie-baby-how-you-doing-havent-heard-from

Frank's first reply is deleted and each subsequent reply has switched authors.


image

Screenshot included

Thanks for pointing it out.

This is definitely a tumblr bug rather than a Frank bug.

There have been a lot of recent tumblr bugs related to the rollout of the Beta editor. Frank does the equivalent of posting through the old (non-Beta) web editor, which often exposes these bugs.

I don’t think I’ve seen this exact one before, although it’s reminiscent of the blank answer bug.

——————–

BTW, did you send the original ask on mobile or web? That might help debug it.

——————–

(Technical details below)

——————–

The OP

In the OP, the ask contains a line with no text, like a double line break.

When I fetch the OP as NPF, this appears (correctly) as a block with empty-string text, like this:

image

The layout for the OP contains a correctly formed ask entry, together with an incorrect rows entry, similar to the blank answer bug.

image

Nonetheless, the OP renders okay on mobile and desktop dash, albeit without the double newline.

Reblogs

When the OP is represented as a trail entry in NPF, the empty-string block is not present:

image

However, the original ask layout entry is preserved, marking blocks 0-2 as the ask.

Thus, in reblogs, Frank’s original reply becomes part of the ask.

All subsequent blocks are shifted up by one from their intended position in the layout.

So the author will switch incorrectly, in a manner dependent on whether each reblog has an odd or even number of blocks. This explains @ajulian’s screenshot.

——————–

@cyle

EDIT: I noticed that I can’t actually see the shifted speaker phenomenon on web or iOS. (I do see the OP itself getting mangled, but reblogs are fine.)

So, the shifted speaker thing may be Android-specific?

fatsexybitch asked:

Hey i think the web/mobile display bug is back. I can't submit to help on my phone, but here's an example (since they follow you) nostalgebraist-autoresponder.tumblr . com/post/649634965468889088/nostalgebraist-autoresponder-seyvetch


image
image

Yeah, this is definitely some kind of NPF bug … not sure I’ve seen this one before?

The post is https://nostalgebraist-autoresponder.tumblr.com/post/649634965468889088/nostalgebraist-autoresponder-seyvetch

When I try to edit it, I see the full conversation in the legacy editor, but only the “Yep!” (like the left screenshot) in the beta editor.  So, looks like it’s a bug in conversion to/from NPF, rather than a frontend display bug

@cyle if you’re interested

admiral-craymen asked:

What's with all of the blank answers from Frank lately?

cyle:

nostalgebraist:

nostalgebraist:

nostalgebraist:

Could you link me to an example?

I don’t see anything fitting that description in the last few pages, and Frank makes too many posts these days for me to read all of them :)

@admiral-craymen​

Maybe it’s Tumblr? This looks blank on my dash but not when I go to the post. https://nostalgebraist-autoresponder.tumblr.com/post/648044658444959744/thoughts-on-vintage-computers

Oh yeah, I see it now… this does seem like a new tumblr display bug.

The web UI has been going through some weirdness lately.  Yesterday I noticed I could now compose indented lists, even in the non-beta editor, and got briefly excited … until I tried to post one, and found that indented lists still don’t display correctly on the web dash!

My findings so far:

—-

I used the API to get these posts in both NPF and legacy formats. I also did this with some non-bugged asks, and some other test cases.

The bugged posts are malformed in NPF, in a specific way. A typical case looks like:

{‘type’: 'ask’, 'blocks’: [0], …}

{'type’: 'rows’, 'display’: [{'blocks’: [0]}, {'blocks’: [1]}], …}

In NPF answer posts, the layout entry of type “ask” designates some content blocks as part of the ask. All other blocks are assumed to be part of the answer.

Here, block 0 is designated as part of the ask. Then, the second layout entry tries to create a “rows” layout including blocks 0 and 1. But block 0 is in the ask, and block 1 is in the answer.

A guess: the UI thinks that if block 1 is rendered at all, it should render as part of the “rows” group it belongs to. But that group cannot be rendered at all … so it just skips block 1.

The posts look normal in legacy format, which matches the fact that they look okay in the https://username.tumblr.com/post/id view. (Possibly dependent on theme)

I have not been able to reproduce the behavior manually. I have tried the following matrix of cases:

  • Ask sent via: mobile, web NPF (new), web legacy
  • Response made with: web legacy, API legacy

@cyle you probably know all this but figured I’d tag you

EDIT: the fact that this is even possible seems like a … if not necessarily a flaw, then a weird property of NPF. I definitely remember that when I read the spec, I was surprised at how loosely the ask/answer distinction was enforced.

yeah this is most certainly a bug on our side, we’ll get it fixed

admiral-craymen asked:

What's with all of the blank answers from Frank lately?

nostalgebraist:

nostalgebraist:

Could you link me to an example?

I don’t see anything fitting that description in the last few pages, and Frank makes too many posts these days for me to read all of them :)

@admiral-craymen​

Maybe it’s Tumblr? This looks blank on my dash but not when I go to the post. https://nostalgebraist-autoresponder.tumblr.com/post/648044658444959744/thoughts-on-vintage-computers

Oh yeah, I see it now… this does seem like a new tumblr display bug.

The web UI has been going through some weirdness lately.  Yesterday I noticed I could now compose indented lists, even in the non-beta editor, and got briefly excited … until I tried to post one, and found that indented lists still don’t display correctly on the web dash!

My findings so far:

—-

I used the API to get these posts in both NPF and legacy formats. I also did this with some non-bugged asks, and some other test cases.

The bugged posts are malformed in NPF, in a specific way. A typical case looks like:

{‘type’: 'ask’, 'blocks’: [0], …}

{'type’: 'rows’, 'display’: [{'blocks’: [0]}, {'blocks’: [1]}], …}

In NPF answer posts, the layout entry of type “ask” designates some content blocks as part of the ask. All other blocks are assumed to be part of the answer.

Here, block 0 is designated as part of the ask. Then, the second layout entry tries to create a “rows” layout including blocks 0 and 1. But block 0 is in the ask, and block 1 is in the answer.

A guess: the UI thinks that if block 1 is rendered at all, it should render as part of the “rows” group it belongs to. But that group cannot be rendered at all … so it just skips block 1.

The posts look normal in legacy format, which matches the fact that they look okay in the https://username.tumblr.com/post/id view. (Possibly dependent on theme)

I have not been able to reproduce the behavior manually. I have tried the following matrix of cases:

  • Ask sent via: mobile, web NPF (new), web legacy
  • Response made with: web legacy, API legacy

@cyle you probably know all this but figured I’d tag you

EDIT: the fact that this is even possible seems like a … if not necessarily a flaw, then a weird property of NPF. I definitely remember that when I read the spec, I was surprised at how loosely the ask/answer distinction was enforced.

cyle:

tarilaran:

reslake:

tarilaran:

nostalgebraist:

  • check
  • out
  • how
  • this
  • post
  • looks
  • on
  • mobile…

I….

image

I don’t get it. The dots are collinear, I guess?

On pc

image

Hey maybe this website is a piece of shit, but it’s *our* piece of shit website

technically the bug is that desktop web doesn’t match mobile 😏 gonna have to file that one

Thanks!

BTW, since this seems to have confused some people: my intent with this post was “look at this weirdly-indented list!”

As far as I can tell, I can only create this indentation structure with the API, not in any of the editors.  (I only know how to create indented lists at all in the markdown editor, and it doesn’t allow fully arbitrary indentation.)

However, due to the web bug, I had to say “on mobile” in the post so people knew how to see it displayed correctly.

cyle:

nostalgebraist:

Wait… is NPF just the draft.js internal json format with a fake mustache?

The “blocks”… the index-based styling… the bizarre indentation system for blockquotes/lists… the janky UX when typing blockquotes… the lack of a canonical HTML representation despite the ability to display it on the screen… no!  it can’t be!

actually, no. funny enough, NPF predates draft.js, and when draft.js came out, we said to ourselves, “this looks very familiar”…

also worth noting that Wordpress’s Gutenberg was developed around the same time as both and landed in a lot of the same places, as did Medium’s internal format, apparently.

basically everybody in 2015-2017 was tackling the problem of “how do we separate ourselves from HTML and leverage JSON because that’s what the apps want, but still have a website renderable in HTML”…

Huh, thanks!

I hadn’t seen that @engineering post either, very informative.

nightpool:

nostalgebraist:

Wait… is NPF just the draft.js internal json format with a fake mustache?

The “blocks”… the index-based styling… the bizarre indentation system for blockquotes/lists… the janky UX when typing blockquotes… the lack of a canonical HTML representation despite the ability to display it on the screen… no!  it can’t be!

blocks and index based styling are both triviably derivable from the underlying design constraints (native mobile friendly formatting), so it wouldn’t surprise me if this was convergent evolution

Thanks for this perspective – I know nothing about mobile development.

(I also know next to nothing about draft.js, I just heard a friend say he was using it and that its data format sounded “a lot like your description of NPF,” and then I looked it up.)

Some comments:

—-

draft.js does not seem to have been built with native mobile in mind.  Their docs currently say “Mobile Not Yet Supported,” which sounds like it’s about mobile web.  For mobile native, there are some 3rd party projects extending draft.js, but nothing 1st party.

—-

Beyond blocks and index based styling, I am also struck by the similarity in the way nested indents are represented.

Compare the example shown under “depth” in this post about draft.js with the NPF spec section on indenting.  I find this striking because the format is so counterintuitive (to me).  Is there a design constraint forcing this as well?

(Also, the NPF spec allows nested indenting – as draft.js does – even though tumblr itself doesn’t appear to have full support for it.  I can’t seem to create an indented list in any UI, even the beta editor.  I can create a nested list using the API, and it renders properly on mobile, but not on web!

ETA: I can make them in the Markdown web editor, with the same display behavior.)

EDIT: wrote this before I saw cyle’s response, which clarifies that NPF came first.