Quick script to count number of bookmarks recorded in pinboard
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
require 'dotenv/load' | |
require 'pinboard' | |
require 'csv' | |
pinboard = Pinboard::Client.new(:token => ENV["PINBOARD_TOKEN"]) | |
CSV.open("stats.csv", "w") do |csv| | |
csv << ["YEAR", "POSTS", "VIA_POCKET"] | |
#I started social bookmarking in 2004 using del.icio.us, then pinboard from May 2013 | |
#started logging read articles in Pocket to pinboard via IFTTT in mid-2018 | |
(2004..2021).each do |year| | |
posts_for_year = pinboard.posts(fromdt: Date.new(year,1,1), todt: Date.new(year,12,31)) | |
posts_from_pocket = pinboard.posts(fromdt: Date.new(year,1,1), todt: Date.new(year,12,31), tag: 'Pocket') | |
csv << [year,posts_for_year.count, posts_from_pocket.count] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment