일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- jsp
- API
- WebProgramming
- query
- 포인터
- request
- 투자
- 윈도우즈
- System
- algorithm
- Call-by-reference
- HTML
- CSS
- meta
- function
- Kafka
- CLASS
- JavaScript
- windows
- UTF-8
- java
- 자료구조
- array
- Sort
- OOP
- c++
- 악성코드
- C
- 노드
- beans
Archives
- Today
- Total
hahahia
[Python] URL Regular Expression 본문
/* 정규식을 이용하여 html 소스에 있는 URL 주소들을 리스트(a) 로 반환하고 출력합니다 */
opener = urllib2.build_opener(
urllib2.HTTPHandler(),
urllib2.HTTPSHandler(),
urllib2.ProxyHandler({'https': 'http://user:pass@proxy:3128'}))
urllib2.install_opener(opener)
html = urllib2.urlopen(SeedURL).read()
fw = open("URL_List.txt", 'w')
crawl = "(http|https):\/\/(([\xA1-\xFEa-z0-9_\-]+\.[\xA1-\xFEa-z0-9:;&#@=_~%\?\/\.\,\+\-]+))"
a = re.findall(crawl, html)
for i in a :
fw.write(i[1]+ "\n")
recur(i[1])
fw.close()