http://otherdomain.com/other.html
http://somedomain.com/other.html
/only.html
테스트를 .html
현재 도메인의 링크에 대한 전체 URL을 어떻게 얻을 수 있습니까?
는 내가 가야 의미 :이
http://otherdomain.com/other.html
http://somedomain.com/other.html
/only.html
테스트를 .html
현재 도메인의 링크에 대한 전체 URL을 어떻게 얻을 수 있습니까?
는 내가 가야 의미 :이
정기적를 사용하여 내 도메인과 일치 does'nt 때문에
http://somedomain.com/other.html
http://somedomain.com/only.html
http://somedomain.com/somedir/test.html
첫 번째 링크는 무시해야 href = "URL"에서 링크를 추출하는 표현 다음 concate
import re
import urlparse
domain = ...
html = ...
links = re.findall('href=[\'"](.*?)[\'"]', html)
links = [urlparse.urljoin(domain, link) for link in links if link]
뭔가
doc.search("a").map do |a|
url = a.attribute("href")
#this part could be a lot more robust, but you get the idea...
full_url = url.match("^http://") ? url : "http://somedomain.com/#{url}"
end.select{|url| url.match("^http://somedomain.com")}
같은 : 도메인과 네이트 것은은 "HTTP"여기
파이썬 예입니다로 시작하지 않는 경우