It is a straight forward operation to be honest, it took much reading and much less code to get it done, hope this saves some other folks some time.
This is how it’s gonna look like in the end
It is a straight forward operation to be honest, it took much reading and much less code to get it done, hope this saves some other folks some time.
This is how it’s gonna look like in the end
Facebook has decided to close our group for political reasons, I’m not gonna discuss that here because its their site in the end and they can run it in whatever way they want, all we can do is become less dependent on facebook and migrate our stuff from there, from now on, I will think twice about posting any useful content on facebook and I will recommend everyone else to do just the same.
So we needed to pull out all the notes from the page we had, totalling 454 notes, there is no export functionality in facebook only an RSS feed that would give you the last 10 items.
So I found a post that shows how to use the API test tool to query the FB database, the relevant query is
SELECT note_id, title, created_time, content FROM note WHERE uid = 0000000000
and change the uid into the id of the facebook page you want.
I was able to get all the notes in XML format, now in order to get those into wordpress we need to import them, here is a post that shows a generic xml parser for wordpress, I had to change the script a bit to make is understand fb’s xml format.
here is the file xmltowp.php
Update: 20100402
Now we have migrated our photo albums from facebook aswell, its a bit more complicated but hey, it works :)
here are the queries for the FB API tool, first get your albums
SELECT name,aid FROM album WHERE owner = 00000000
next use the album ID to get the photos info for each album alone
SELECT pid, aid, src_big, src_big_height, src_big_width, link, caption, created, modified, object_id FROM photo WHERE aid= '00000000_00000'
now we have an XML file with all the photos info, lets get the URL and get all the files
$grep '<src_big>' album.xml > urls
in VIM do the following substitutes on the urls file
:%s/ <src_big>//g :%s/<\/src_big>//g
now feed the urls file to wget through the -i option.
I have used the NextGEN gallery module for WordPress, using that I was able to import whole folders, the folders where wget saved all those photos. Now to get the captions of the original photos in WordPress aswell I have written a small ruby script that parses the albums.xml and generates an SQL file that you need to execute against your wordpress DB, here is the code, ugly but works
#!/usr/bin/ruby
require "rexml/document"
include REXML
file = File.new( "album.xml" )
doc = Document.new file
output = ""
doc.elements.each("*/photo") { |element|
filename = ''
caption = ''
XPath.each( element, "src_big") { |src| filename = File.basename(src.text) }
XPath.each( element, "caption") { |cap| caption = cap.text }
output << "update wp_ngg_pictures set description = '#{caption}', alttext='#{caption}' where filename='#{filename}';\n"
}
outfile = File.new("update.sql", "w")
outfile << 'SET CHARACTER_SET_CLIENT=utf8;'
outfile << 'SET CHARACTER_SET_CONNECTION=utf8;'
outfile << 'SET CHARACTER_SET_RESULTS=utf8;'
outfile << output
hope this helps someone in need.

Obsessed with football? Afraid of missing out on anything off the upcoming WORLD CUP? This cool application will keep you updated with all the results and latest news. Get it now, and carry WORLD CUP 2010 within your pocket!

Here is what you get from this outstanding application:

We love football with a passion, we created this app for us and for you! A great deal of effort has been put in designing, developing and testing all the functionalities to make sure that this app is the best for football lovers and to let us and you enjoy the games to the max!

If you have any comments or suggestions please don’t hesitate in contacting us either on iTunes store or on our website, www.barmajeyat.com
to get decent SEO URLs in your rails app, app the following snippet to the model in question
#change the URL of the apps to be more SEO friendly
def to_param
"#{id}-#{parameterize}"
end
that would generate URLs as the following
http://www.barmajeyat.com/apps/1-tajweed