Skip to content

Instantly share code, notes, and snippets.

@andrei512
Created August 13, 2012 13:39
Show Gist options
  • Save andrei512/3340896 to your computer and use it in GitHub Desktop.
Save andrei512/3340896 to your computer and use it in GitHub Desktop.
def forum_link
doc = Nokogiri::HTML(open(ia_link))
puts "$" * 100
link = doc.css("script").select { |node|
re = %r/topic_id=(?<forum_id>[[:digit:]]+)/
match = re.match(node.content)
if match
match[1]
else
nil
end
}.collect { |node|
re = %r/topic_id=(?<forum_id>[[:digit:]]+)/
match = re.match(node.content)
match[1]
}
"http://infoarena.ro/forum/index.php?topic=#{link.first}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment