Hacker Who

Network is wide like the Universe. Allons-y!

ruby 로 웹페이지 가져와서 링크 추출하기

  1. require 'net/http'
  2.  
  3. html = Net::HTTP.get 'www.apple.com', '/'
  4.  
  5. html.gsub(/((https?:\/\/|www\.)([-\w\.]+)+(:\d+)?(\/([\w\/_\.]*(\?\S+)?)?)?)/i) do |s|
  6.     puts s
  7. end

누가 필요하다고 하셔서 간단하게 만들어봤습니다.

기록 겸..

posted by 골빈해커 in 프로그래밍 and have No Comments

Live reply

Name
Email
Website
Message