Embedding Tumblr

Get up to date with the goings on of the forum

Moderator: Jake

Post Reply
User avatar
Rommeltje
The man in charge
Posts: 10235
Joined: Sat Nov 20, 2010 10:14 pm
Location: Amsterdam
Contact:

Embedding Tumblr

Post by Rommeltje » Sun Mar 08, 2015 7:04 pm

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:

User avatar
SexySurgical
Rommeltje's Deputy
Posts: 7951
Joined: Wed Nov 24, 2010 1:04 am
Location: Dutchieland
Contact:

Re: Embedding Tumblr

Post by SexySurgical » Mon Mar 09, 2015 1:28 am

Very najs. Aai lajk.

User avatar
Rommeltje
The man in charge
Posts: 10235
Joined: Sat Nov 20, 2010 10:14 pm
Location: Amsterdam
Contact:

Re: Embedding Tumblr

Post by Rommeltje » Mon Mar 09, 2015 1:53 am

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.

User avatar
glovemad
Occasional poster
Posts: 49
Joined: Mon Nov 14, 2011 1:01 pm
Location: Sheffield, UK
Contact:

Re: Embedding Tumblr

Post by glovemad » Tue Mar 10, 2015 10:24 pm

*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*
My Tumblr
My FetLife
Always up for a chat!

User avatar
Rommeltje
The man in charge
Posts: 10235
Joined: Sat Nov 20, 2010 10:14 pm
Location: Amsterdam
Contact:

Re: Embedding Tumblr

Post by Rommeltje » Wed Mar 11, 2015 12:04 am

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!

User avatar
glovemad
Occasional poster
Posts: 49
Joined: Mon Nov 14, 2011 1:01 pm
Location: Sheffield, UK
Contact:

Re: Embedding Tumblr

Post by glovemad » Wed Mar 11, 2015 1:07 am

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.
My Tumblr
My FetLife
Always up for a chat!

Post Reply