Skip to content

Instantly share code, notes, and snippets.

"""
Generate New Provider list for jQuery oEmbed.
"""
import json
import urllib2
import json
import re
def main():
response = urllib2.urlopen('http://api.embed.ly/v1/api/services/javascript')
(function($) {
$.fn.oembed = function(url, options, callback) {
options = $.extend(true, $.fn.oembed.defaults, options);
return this.each(function() {
var container = $(this),
resourceURL = (url != null) ? url : container.attr("href"),
provider;
import urllib2
import urllib
import json
import memcache
import re
#[url=http://example.com]Example[/url] OR [url]http://example.com[/url]
bbcode_url_re = re.compile('\[url(|\=(?P<url>.*?))\](?P<url_or_title>.*?)\[/url]')
cache = memcache.Client(['127.0.0.1:11211'])
MAX_WIDTH = 600
import urllib2
import json
import re
response = urllib2.urlopen('http://api.embed.ly/v1/api/services/python')
services = json.loads(response.read())
url = 'http://soundcloud.com/dociler/dociler-futuricity'
for service in services:
for regex in service['regex']:
if re.match(regex, url):
print "Matched %s to %s" % (url, service['displayname'])
[{u'about': u"YouTube is the world's most popular online video community, allowing millions of people to discover, watch and share originally-created videos. YouTube provides a forum for people to connect, inform, and inspire others across the globe and acts as a distribution platform for original content creators and advertisers large and small.",
u'displayname': u'YouTube',
u'domain': u'youtube.com',
u'favicon': u'http://c1611152.cdn.cloudfiles.rackspacecloud.com/youtube.ico',
u'name': u'youtube',
u'regex': [u'http://.*youtube\\.com/watch.*',
u'http://.*\\.youtube\\.com/v/.*',
u'http://youtu\\.be/.*',
u'http://.*\\.youtube\\.com/user/.*\\#.*',
u'http://.*\\.youtube\\.com/.*\\#.*/.*'],
urls = getUrls(status.text);
if (urls != null){
$.each(urls, function(index, url){
$.embedly(url, {maxWidth:580}, function(oembed){
if (oembed != null){
$("LI#status_"+status.id).append(oembed.code);
return false;
}
});
});
function homeTimeline(){
$('div#tweets OL').html('');
twttr.anywhere(function (T) {
T.currentUser.homeTimeline().first(10).each(function(status) {
createStatus(status);
T("LI#status_"+status.id).hovercards();
});
});
}
T("#login").connectButton(
{ size: "large",
authComplete: function(user) {
createUserInfo(T.currentUser);
homeTimeline();
T("#tweetbox").tweetBox({
height: 50,
width: 590,
defaultContent: "",
onTweet : function(p,h) {homeTimeline();}
@embedly
embedly / simple_twitter_search.html
Created May 3, 2010 17:19
Simple example of Twitter Search with Embedly
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="http://scripts.embed.ly/jquery.embedly.js"></script></head>
<body>
<form action="" method="get"><input type="text" name="q"/><input type="submit" name="q" value="Search"/></form>
<ul></ul>
<script>
function searchTwitter(q){
//Force twitter to only search image providers
http://www.slideshare.net/doina/happy-easter-from-holland-slideshare
http://www.slideshare.net/stinson/easter-1284190
http://www.slideshare.net/angelspascual/easter-events
http://www.slideshare.net/sirrods/happy-easter-3626014
http://www.slideshare.net/sirrods/happy-easter-wide-screen
http://www.slideshare.net/carmen_serbanescu/easter-holiday
http://www.slideshare.net/Lithuaniabook/easter-1255880
http://www.slideshare.net/hues/easter-plants
http://www.slideshare.net/Gospelman/passover-week
http://www.slideshare.net/angelspascual/easter-around-the-world-1327542