Created
January 18, 2011 23:46
-
-
Save antonioalegria/785405 to your computer and use it in GitHub Desktop.
Testing Superfeedr's track API using superfeedr-ruby
This file contains hidden or 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
DEBUG : RESOLVING: _xmpp-client._tcp.superfeedr.com (SRV) | |
DEBUG : Found 8 SRV records for _xmpp-client._tcp.superfeedr.com. | |
DEBUG : Trying connection with : xmpp5.superfeedr.com:5222 | |
DEBUG : CONNECTING TO xmpp5.superfeedr.com:5222 with Superfeedr as connection handler | |
DEBUG : CONNECTED | |
DEBUG : SENDING : <?xml version="1.0"?> | |
<stream:stream xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams" to="superfeedr.com" version="1.0"> | |
DEBUG : SENDING : <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"/> | |
DEBUG : SENDING : <?xml version="1.0"?> | |
<stream:stream xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams" to="superfeedr.com" version="1.0"> | |
DEBUG : SENDING : <auth mechanism="PLAIN" xmlns="urn:ietf:params:xml:ns:xmpp-sasl">XXXX-REPLACED-XXXX</auth> | |
DEBUG : SENDING : <?xml version="1.0"?> | |
<stream:stream xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams" to="superfeedr.com" version="1.0"> | |
DEBUG : SENDING : <iq type="set" id="8056708"> | |
<bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"> | |
<resource>skates_client_8056708</resource> | |
</bind> | |
</iq> | |
DEBUG : SENDING : <iq type="set" id="4816"> | |
<session xmlns="urn:ietf:params:xml:ns:xmpp-session"/> | |
</iq> | |
DEBUG : SENDING : <presence/> | |
DEBUG : SENDING : <iq type="get" to="firehoser.superfeedr.com" id="823" from="[email protected]"> | |
<pubsub xmlns="http://jabber.org/protocol/pubsub"> | |
<subscriptions page="1" jid="[email protected]"/> | |
</pubsub> | |
</iq> | |
DEBUG : SENDING : <iq type="set" to="firehoser.superfeedr.com" id="482" from="[email protected]"> | |
<pubsub xmlns="http://jabber.org/protocol/pubsub"> | |
<subscribe node="http://superfeedr.com/track/apple" jid="[email protected]"/> | |
</pubsub> | |
</iq> | |
DEBUG : PARSED : <iq from="firehoser.superfeedr.com" to="[email protected]/skates_client_8056708" type="result" id="823"> | |
<pubsub xmlns="http://jabber.org/protocol/pubsub" xmlns:superfeedr="http://superfeedr.com/xmpp-pubsub-ext"> | |
<subscriptions superfeedr:page="1"> | |
<subscription node="http://superfeedr.com/track/apple" jid="[email protected]" subscription="subscribed" superfeedr:digest="false" superfeedr:format="atom"> | |
<superfeedr:status> | |
<superfeedr:http code="304">Content not modified</superfeedr:http> | |
<superfeedr:next_fetch>2011-01-19T00:00:29+00:00</superfeedr:next_fetch> | |
<superfeedr:period>900</superfeedr:period> | |
<superfeedr:last_fetch>2011-01-18T23:45:29+00:00</superfeedr:last_fetch> | |
<superfeedr:last_parse>2011-01-18T16:23:37+00:00</superfeedr:last_parse> | |
<superfeedr:last_maintenance_at>2011-01-16T16:23:36+00:00</superfeedr:last_maintenance_at> | |
</superfeedr:status> | |
</subscription> | |
</subscriptions> | |
</pubsub> | |
</iq> | |
DEBUG : SENDING : <iq type="get" to="firehoser.superfeedr.com" id="813" from="[email protected]"> | |
<pubsub xmlns="http://jabber.org/protocol/pubsub"> | |
<subscriptions page="2" jid="[email protected]"/> | |
</pubsub> | |
</iq> | |
Received subscription page 1: ["http://superfeedr.com/track/apple"] | |
DEBUG : PARSED : <iq from="firehoser.superfeedr.com" to="[email protected]/skates_client_8056708" type="result" id="482"> | |
<pubsub xmlns="http://jabber.org/protocol/pubsub"> | |
<subscription node="http://superfeedr.com/track/apple" jid="[email protected]" subscription="subscribed"> | |
<status xmlns="http://superfeedr.com/xmpp-pubsub-ext"> | |
<http code="304">Content not modified</http> | |
<next_fetch>2011-01-19T00:00:29+00:00</next_fetch> | |
<period>900</period> | |
<last_fetch>2011-01-18T23:45:29+00:00</last_fetch> | |
<last_parse>2011-01-18T16:23:37+00:00</last_parse> | |
<last_maintenance_at>2011-01-16T16:23:36+00:00</last_maintenance_at> | |
</status> | |
</subscription> | |
</pubsub> | |
</iq> | |
Subscribed to : ["http://superfeedr.com/track/apple"] | |
DEBUG : PARSED : <iq from="firehoser.superfeedr.com" to="[email protected]/skates_client_8056708" type="result" id="813"> | |
<pubsub xmlns="http://jabber.org/protocol/pubsub" xmlns:superfeedr="http://superfeedr.com/xmpp-pubsub-ext"> | |
<subscriptions superfeedr:page="2"/> | |
</pubsub> | |
</iq> | |
Received subscription page 2: [] |
This file contains hidden or 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
Thread.abort_on_exception = true | |
require "rubygems" | |
require "bundler/setup" | |
require 'superfeedr' | |
FEEDS = ["http://superfeedr.com/track/apple"] | |
Skates.logger.level = Log4r::DEBUG | |
Superfeedr.connect("[email protected]", "password") do | |
Superfeedr.subscriptions do |page, result| | |
puts "Received subscription page #{page}: #{result.inspect}" | |
Superfeedr.unsubscribe(result - FEEDS) do |f| | |
puts "Unsubscribed feed #{f.inspect}" | |
end | |
end | |
Superfeedr.on_notification do |notification| | |
puts "The feed #{notification.feed_url} has been fetched (#{notification.http_status}: #{notification.message_status}) and will be fetched again in #{(notification.next_fetch - Time.now)/60} minutes at most." | |
end | |
# Subscribe to all the feeds | |
Superfeedr.subscribe(FEEDS) do |f| | |
puts "Subscribed to : #{f}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment