Showing posts with label scrape mobile phone number. Show all posts
Showing posts with label scrape mobile phone number. Show all posts
Thursday, July 26, 2012
Scraping mobile phone number from web
web.search("td").each do |e|
e = e.inner_html
if e.length > 10
tmp = e.gsub(/(\r|\n|\t|\D)/, "")
tmp.split(/(010|012|013|016|014|017|018|019)/).each do |s|
if s =~ /(010|012|013|016|014|017|018|019)/
pos = tmp =~ /#{s}/
#puts pos
if pos
number = "#{s}#{tmp[pos+3..pos+9]}"
puts number
Contact.create(:group_id => 1, :phone => number) if number.length == 10
end
end
end
end
end
Subscribe to:
Posts (Atom)