Skip to content

Instantly share code, notes, and snippets.

View screeley's full-sized avatar

Sean Creeley screeley

View GitHub Profile
@screeley
screeley / i18n.js
Created April 22, 2014 17:49
Embedly Card Translations
{
"Embed": {
en : 'Embed',
es : 'Insertar',
tr : 'Embed',
de : 'Einbetten'
},
"Share": {
de: "Teilen",
tr: "Payla\u015f"
I18N.prototype.translations = {
"Embed": {
en: 'Embed',
es: 'Insertar',
tr: 'Embed',
de: 'Einbetten',
fr: 'Ins\u00E9rer',
ja: 'Embed',
zh: '\u5D4C\u5165\u5185\u5BB9',
ko: '\uC784\uBCA0\uB4DC'
#
# Script From: http://blog.davidziegler.net/post/122176962/a-python-script-to-automatically-extract-excerpts-from
#
# "http://www.sfgate.com/cgi-bin/article.cgi?f=/c/a/2009/06/04/DD7V1806SV.DTL&type=performance"
Opera review: 'Tosca' arias pulsate : Close [X]Quick links to the best of SFGate | Still can't find it? see Site Index
# "http://www.chloeveltman.com/blog/2009/05/two-very-different-symphonies.html#links",
lies like truth: Two Very Different Symphonies : The diversity of the Bay Area can be witnessed in many different ways, from the variety of the cuisine offered in its restaurants to the multitudinous kinds of topography. One less obvious way to explore the radical differences that coexist in this part o
"""
A script for automatically extracting excerpts from articles. It requires lxml.
Usage::
from lxml_extractor import get_summary
url = "http://someurl.com/goes/here"
(title,description) = get_summary(url)
import re
import urllib
import urllib2
# JSON decoder
try:
import json
except ImportError:
try:
import simplejson as json
<div class="vodpod_player">
<embed src="http://www.youtube.com/v/3fmw01mAvkw&fs=1&showinfo=0&showsearch=0&rel=0&hl=en_US"
type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true"
wmode="opaque" width="400" height="320"></embed>
<img src="http://stats.vodpod.com/stats/view/7619747/518458/4056/pod.gif" width="1"
height="1" style="margin:0 -1px -1px 0;border:none;padding:0;display:inline;">
<img src="http://s.vodpod.com/stats/video/4959049/1//KW2iDoVtAYHDGaSEr0V+sDZPO+hOc3+ZxmYyDp4t4Iw="
width="1" height="1" style="margin:0 -1px -1px 0;border:none;padding:0;display:inline;">
</div>
@screeley
screeley / gist:957841
Created May 5, 2011 20:21
OAuth Embedly
import oauth2 as oauth
import time
import urllib, urllib2
# Set the API endpoint
url = "http://pro.embed.ly/1/preview"
urls = ['http://google.com', 'http://apple.com']
params = {
@screeley
screeley / change_user_agents.py
Created May 31, 2011 20:02
Change.org is changing responses for Facebook and Google
## Change.org. We are going to start using facebook's user-agent. FYI.
In [1]: import urllib2
In [2]: req = urllib2.Request('http://www.change.org/petitions/boston-red-sox-please-make-an-it-gets-better-video')
#Embedly's User Agent
In [3]: req.add_header('User-Agent', 'Mozilla/5.0 (compatible; Embedly/0.2; +http://support.embed.ly/)')
In [4]: urllib2.urlopen(req).read()
#Random HTML that sets cookies
Out[4]: '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><meta http-equiv="Content-Script-Type" content="text/javascript"><script type="text/javascript">function setCookie(c_name, value, expiredays) { var exdate = new Date(); exdate.setDate(exdate.getDate()+expiredays); document.cookie = c_name + "=" + escape(value) + ((expiredays==null) ? "" : ";expires=" + exdate.toGMTString()) + ";path=/"; } function getHostUri() { var loc = document.location; return loc.toString(); } setCookie(\'YPF8
#!/usr/bin/env python
"""Proxy"""
import urllib
import json
import tornado.httpserver
import tornado.ioloop
import tornado.web
import tornado.wsgi
import tornado.httpclient
import time
import functools
import tornado.httpserver
import tornado.ioloop
import tornado.web
import tornado.wsgi
import tornado.httpclient