Page 1 of 1

Embedding Tumblr

Posted: Sun Mar 08, 2015 7:04 pm
by Rommeltje
It is now possible to embed Tumblr posts! :w00t:

It's basically the same as embedding Youtubes. For example, if this is your Tumblr url:

worldofglovefetish.tumblr.com/post/112655251544/nacnac-toons-heres-one-out-of-two-panels-that-i

This is how you embed it:

[tumblr=112655251544][/tumblr]

Resulting in:
[tumblr=112655251544][/tumblr]

:yay:

Re: Embedding Tumblr

Posted: Mon Mar 09, 2015 1:28 am
by SexySurgical
Very najs. Aai lajk.

Re: Embedding Tumblr

Posted: Mon Mar 09, 2015 1:53 am
by Rommeltje
Oh, hold up! :$ Sorry, this only works for post from the worldofglovefetish-Tumblr. I can't make it work every blog. :-/

My apologies. Well, at least we can embed some Tumblr posts now then.

Re: Embedding Tumblr

Posted: Tue Mar 10, 2015 10:24 pm
by glovemad
*puts programmer's hat on*

I'm sure there must be a way of specifying the source user as well, probably would need the phpBB mod (I'm guessing that's what it is?) to accept both together in the BB code, maybe something like:

Code: Select all

[tumblr=username:123456789][/tumblr]
Obviously, a little bit more complicated than just a post ID, but coming from a programming background, adding the username shouldn't be a difficult task, unless for some reason you've had to add an API key or secret to the mod to get it to work, in which case, then it's a bit more complicated.

If you want a second opinion to get it to work for all users, I may be able to assist :), unless you already have someone that can sort that stuff out!

*takes hat off*

Re: Embedding Tumblr

Posted: Wed Mar 11, 2015 12:04 am
by Rommeltje
No, the problem is that the embed code generates a second string of numbers for the username. It'd be a bit much to ask people to find those numbers and add them in the tags.

As it is now, you only have to fill in the ID-tag of the post.

This is the embed code that needs to be 'BBCodified':

Code: Select all

<div class="tumblr-post" data-href="https://embed.tumblr.com/embed/post/gCh2-2LZ5pwestGdZI37jQ/112655251544" data-did="e92254e92e55533de5018f648ba71bedc6f59cdb"><a href="http://worldofglovefetish.tumblr.com/post/112655251544">http://worldofglovefetish.tumblr.com/post/112655251544</a></div><script async src="http://assets.tumblr.com/post.js"></script>
To turn that into BBCode, first I have to replace the ID with an identifier token:

Code: Select all

<div class="tumblr-post" data-href="https://embed.tumblr.com/embed/post/gCh2-2LZ5pwestGdZI37jQ/{IDENTIFIER}" data-did="e92254e92e55533de5018f648ba71bedc6f59cdb"><a href="http://worldofglovefetish.tumblr.com/post/{IDENTIFIER}">http://worldofglovefetish.tumblr.com/post/{IDENTIFIER}</a></div><script async src="http://assets.tumblr.com/post.js"></script>
The corresponding BBCode then looks like this:

Code: Select all

[tumblr={IDENTIFIER}][/tumblr]
I could add a token to make it so that you could also fill in the username. The html part would then look like this:

Code: Select all

<div class="tumblr-post" data-href="https://embed.tumblr.com/embed/post/gCh2-2LZ5pwestGdZI37jQ/{IDENTIFIER2}" data-did="e92254e92e55533de5018f648ba71bedc6f59cdb"><a href="http://{IDENTIFIER1}.tumblr.com/post/{IDENTIFIER2}">http://{IDENTIFIER1}.tumblr.com/post/{IDENTIFIER2}</a></div><script async src="http://assets.tumblr.com/post.js"></script>
With the BBCode looking like this:

Code: Select all

[tumblr={IDENTIFIER1}]{IDENTIFIER2}[/tumblr]
But that doesn't work, because apparently, there's information about the username in either this part of the code:

Code: Select all

https://embed.tumblr.com/embed/post/gCh2-2LZ5pwestGdZI37jQ/
Or this:

Code: Select all

data-did="e92254e92e55533de5018f648ba71bedc6f59cdb"
And there's no way to generate that with a BBCode. At least none that I know of. If you do know how to do that, I'd love to hear it.

Either way, thanks for offering your help!

Re: Embedding Tumblr

Posted: Wed Mar 11, 2015 1:07 am
by glovemad
Hmm, OK that is interesting. I didn't consider they'd end up encoding the username/userid in some way in the embed URL. Perusing the post.js file it looks like the crucial detail is that bit in the data-href attribute, as it looks like the data-did attribute is optional. I can't quite figure out how that encoded string relates back to the user in some way. Can't find any other posts about it either, apart from another developer thinking about the same issue, but with no response.