• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
Adding BB Code Media Sites Using oEmbed

Adding BB Code Media Sites Using oEmbed

How to add oEmbed (using Twitter as an example)

Jaxel

Well-known member
#1
Jaxel submitted a new resource:

Adding BB Code Media Sites Using oEmbed - How to add oEmbed (using Twitter as an example)

What is oEmbed? Many websites that allow you to embed content also use something called oEmbed. Most of the time (such as YouTube) its not needed, since most websites have a consistent embed code based on iFrames or object/embed codes.

However, sometimes the item you want to embed doesn't have such a thing, and instead has text content. When embedding text content, there usually isn't a constant embed code. So instead of being able to just take the ID of content and embedding the code; you...
Read more about this resource...
 

Jaxel

Well-known member
#3
Why not make a dope oembed media sites package? :whistle:
Because I dog-food. And except for Twitter I have no need for oembed. I don't use iFixIt, Wikipedia or any of the other text embed websites out there.

In fact, XenMedio doesn't use any oEmbed, for the reasons I explained in the overview of this tutorial.

There is a downside to oEmbed too... the Http request can slow down the loading of your page if Twitter goes down.
 

Jaxel

Well-known member
#4
Jaxel updated Adding BB Code Media Sites Using oEmbed with a new update entry:

Case Study... Caching Tweets

So the guide already shows you exactly how to use oEmbed to embed tweets on your forum. However, with the use of oEmbed, there are a few problems.

The first problem is rate-limiting. Twitter will automatically rate-limit queries to their API, so that websites and users don't bang on their servers too much from outside sources. The second is the inevitability of the Fail Whale. When Twitter goes down, the Zend_Http request will stall as it tries to fetch the oEmbed information; and this can...
Read the rest of this update entry...
 

Jaxel

Well-known member
#5
Jaxel updated Adding BB Code Media Sites Using oEmbed with a new update entry:

Error in my cache code...

I realized there was an error in my cache code. When the cache expired, it would fail to update the cache properly and produce an error instead...

These are my fixed codes:
Code:
<?php

class EWRcustom_BbCode_Embed
{
    public static function embedTwitter($mediaKey, array $site)
    {
        $tweetModel = XenForo_Model::create('EWRcustom_Model_Tweets');
       
        if (!$tweet = $tweetModel->getTweetByID($mediaKey, 28))
        {
            $client = new...
Read the rest of this update entry...