Skip to content

Instantly share code, notes, and snippets.

@lnaia
Last active November 16, 2015 14:48
Show Gist options
  • Save lnaia/96bee26aebb5b7f70f95 to your computer and use it in GitHub Desktop.
Save lnaia/96bee26aebb5b7f70f95 to your computer and use it in GitHub Desktop.
Hunting for the one plus x...
#!/usr/bin/ruby
require 'nokogiri'
require 'open-uri'
doc = Nokogiri::HTML(open("https://www.reddit.com/r/oneplus/comments/3qtbx1"))
doc.css(".usertext-body .md").drop(2)[0 .. 4].each {|comment|
text = comment.text.strip
text.gsub!(/\n/, '')
puts "> #{text}\n\n"
}
=begin
sample output
Every 10.0s: ./oneplusx.rb Mon Nov 16 14:47:38 2015
> Time to give back: I have 3 OnePlus 2 invites for Europe. PM me if interested.
> oneplus x: http://onepl.us/EUEB-8397-CxxD-16A4 , where xx= "The answer to life, the universe and everything"
> Gone, surprised someone got that before I did!
> Invite for the Oneplus 2:GLAD-B3DE-90€8-CD€FReplace € with 4
> I have one Oneplus X invite valid in Europe.btw, I got mine a week ago and it's awsome :)
=end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment