Posts

Showing posts from June, 2011

Get Images Bookmarklet

I wonder why all Internet browsers do not provide us with a built-in and simple way to download multiple images, such as those excellent photos from my favorite Boston.com's The Big Picture . The closest thing that fit my need is Bulk Image Downloader and Firefox Extensions ( Image Picker ). The thing is, I certainly don't want to pay for something that can be free, and secondly, I don't use Firefox as my primary Internet browser (Hail Opera!) My first plan was to make an Opera extension similar to Firefox's Image Picker, which basically read a page, select the images and then call the built-in download manager to save it to local folder. However, I'm having a real hard time finding the Opera API function to call the Opera download manager to download even a single url. So, I end up writing just this simple bookmarklet to grab the images url, and execute Free Download Manager to perform the download. For now, the bookmarklet only extract direct source url of ima

FBNotify.py

#coding=utf-8 #FBNotify.py: Facebook Simple Notifier # by Herry Limantoro (mataherry@gmail.com) # #NOTE: Don't forget to Add the Mechanize source folder into your SL4A scripts folder (/mnt/sdcard/sl4a/scripts) # http://wwwsearch.sourceforge.net/mechanize/download.html import android import time import sys import traceback import urllib import mechanize import BeautifulSoup import re droid = android.Android() #Setup Browser br = mechanize.Browser() br.set_handle_redirect(True) br.set_handle_robots(False) #User Agent, can't do without it br.addheaders = [('User-agent','Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008071615 Fedora/3.0.1-1.fc9 Firefox/3.0.1')] url = 'http://m.facebook.com/notifications.php' #Set username password here, leave blank to prompt for username/password username = '' password = '' #Set run interval (in minutes), prompt if 0 interval = 0 def get_interval(): droid.dialogCreateAlert('R

Android Facebook Simple Notifier using SL4A

Image
Like many Android phone users, I wonder why the Android Market Facebook app lacks push notifications like BB or iPhone. Currently it only notify when there is new message, or event and friend request. So, when I get acquainted with SL4A , this is the first app pop up in my mind. However, reading through the Facebook API and having to handle oAuth and stuffs seem just too much work. So, I thought if only I could open my mobile version of FB notification page ( http://m.facebook.com/notifications.php ) and read the new notifications, that would do it. And upon googling on emulate browser using python, I found these two excellent tutorials: http://stockrt.github.com/p/emulating-a-browser-in-python-with-mechanize/ http://www.ibm.com/developerworks/linux/library/l-python-mechanize-beautiful-soup/  I guess the neat trick is to "disguise" the User Agent of the mechanize Browser. From there on, it's basically parsing the HTML source behind the notification page. One last bit