Created
March 16, 2010 19:24
-
-
Save harrigan/334389 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'blogger' | |
require 'mechanize' | |
require 'set' | |
STDOUT.sync = true | |
gmail_url = 'http://www.gmail.com' | |
gmail_username = 'username' | |
gmail_password = 'password' | |
blogger_blog_id = '12345' | |
blogger_blog_name = 'blog_name' | |
blogger_id = '1234567890' | |
blogger_username = gmail_username | |
blogger_password = gmail_password | |
# log in to your gmail account | |
agent = Mechanize.new | |
page = agent.get gmail_url | |
form = page.forms.first | |
form.Email = gmail_username + '@gmail.com' | |
form.Passwd = gmail_password | |
page = agent.submit form | |
# get the list of ids as per google reader | |
reader_ids = Set.new | |
page = agent.get("http://www.google.com/reader/atom/feed/" + | |
"http://#{blogger_blog_name}.blogspot.com/feeds/posts/default?r=n&n=100") | |
page.body.scan(/https\:\/\/blogger.googleusercontent.com\/tracker\/\d*\-(\d*)\?/).each do |id| | |
reader_ids << id.to_s | |
end | |
# get the list of ids as per blogger | |
account = Blogger::Account.new(blogger_id, blogger_username, blogger_password) | |
if account.authenticated? | |
blog = account.blog_for_id(blogger_blog_id) | |
blog.posts.each do |post| | |
reader_ids.delete(post.id) | |
end | |
end | |
# the following posts have been deleted | |
reader_ids.each do |id| | |
puts id | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment