Friday, May 11, 2012

Background

I've been doing some work for some fellow conservatives at two different media outlets lately: Own The Narrative and All Fired Up Media. Both of which have live talk radio as a central aspect to their operations. There are multiple hosts using different platforms to accomplish this. Ustream and LiveStream are the most forthcoming and easiest to work with of the services. This post isn't about them. It's about the pain in the ass that is BlogTalk.

Research

There is absolutely no API for BlogTalk. They make it very difficult to embed user content outside of their website.
Any claims you read that there is a podcasting API for BTR are horsecrap.

The Solution

This is far from an elegant solution like you would get from an API or even a friendly livecasting site, but it works and here's how:
First it scrapes the html from a designated channel from BTR
Then the contents of the html file are read line-by-line until...
It finds the magic words "On Air Now:"
Then it parses out the link to the event on BTR and formats the url so it is friendly to other sites then...
It returns an iframe with the embed.

function btr_show($channel) {
    $whole_btr = file_get_contents("http://www.blogtalkradio.com/$channel");
    $lines = explode("\n", $whole_btr);
    foreach ($lines as $line) {
        if (stristr($line, 'On Air Now:')) {
            $address = next(explode('"', $line));
            $embed = "http://blogtalkradio.com" . $address . "/scrub/0";
            return "<iframe src='$embed' class='btr' scrolling='no'></iframe>";
        }
    }
}

Note: my .btr css class looks something like this but use whatever you want.

.btr{
    width:230px; 
    height: 200px;
    border:0;
}
Reactions:

8 comments:

  1. Thanks for the share, Im not a developer could you explain a bit more on how to use it? I assume that the function goes into the functions.php. How do I insert that function into my template?

    Thanks for the help,

    Eric

    ReplyDelete
    Replies
    1. If you're not a developer and are using Wordpress, I could write a WordPress widget plugin to make things easier.

      Delete
  2. You should be a part of a contest for one of the highest quality sites on the
    internet. I am going to highly recommend this blog!

    Also visit my web site :: ロレックス偽物

    ReplyDelete
  3. I used to be able to find good information from your articles.


    Also visit my web-site: 激安ロレックスコピー

    ReplyDelete
  4. Please let me know if you're looking for a article author for your weblog. You have some really great articles and I feel I would be a good asset. If you ever want to take some of the load off, I'd really like to write some material for your
    blog in exchange for a link back to mine. Please send me an e-mail
    if interested. Many thanks!

    My blog post ロレックス偽物

    ReplyDelete
  5. Excellent article. I am experiencing some of these issues as well.

    .

    Feel free to surf to my web blog - http://www.pradasale-shop.com/

    ReplyDelete
  6. Hello, its pleasant article about media print, we
    all be familiar with media is a impressive source of data.


    Here is my blog - 激安プラダ バッグ

    ReplyDelete
  7. My partner and I absolutely love your blog and find nearly all of your post's to be what precisely I'm looking for.
    Would you offer guest writers to write content in your case?
    I wouldn't mind producing a post or elaborating on many of the subjects you write regarding here. Again, awesome website!

    my page: ブランドコピー販売

    ReplyDelete

Subscribe to RSS Feed Follow me on Twitter!