Skip to content

Commit

Permalink
Added instagram support
Browse files Browse the repository at this point in the history
  • Loading branch information
Shamail Tayyab committed Nov 1, 2012
1 parent 9aa2dd2 commit 726ed02
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
17 changes: 16 additions & 1 deletion src/fallenthrone/lib/providers.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
import urlparse
import os

class ImageServiceProvider (object):

def __init__ (self):
pass

def instagram (self, url, parsed):
return self.instagr (url, parsed)

def instagr (self, url, parsed):
path = parsed.path
if path.endswith ("/"):
path = path[:-1]
shortcode = os.path.basename (path)
print shortcode
return {
"image": "http://instagr.am/p/%s/media/?size=l" % (shortcode),
"thumbnail": "http://instagr.am/p/%s/media/?size=t" % (shortcode),
}

def yfrog (self, url, parsed):
return {
"image": "http://yfrog.com%s:medium" % (parsed.path),
Expand All @@ -19,6 +34,6 @@ def parse (self, url):
print "%s Image Detected" % (urlname)
return parse_fn (url, parsed)
else:
print "Unknown provider:", urlname
print "Unknown provider: %s (%s)" % (urlname, url)
return False

2 changes: 1 addition & 1 deletion src/fallenthrone/lib/tweetparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def following (self):
return friends

def parse (self, handle):
statuses = self.api.GetUserTimeline (handle, count = 5, include_rts = True, include_entities = True)
statuses = self.api.GetUserTimeline (handle, count = 200, include_rts = True, include_entities = True)
images = []
serviceprovider = ImageServiceProvider ()
for i in statuses:
Expand Down

0 comments on commit 726ed02

Please sign in to comment.