link extractor

kyugyusinn·2022년 12월 19일
0

TIP for webhack

목록 보기
1/2

입력한 URL에서 모든 내부 및 외부 링크를 추출하는 python 코드.
링크 추출하는 코드는 많지만 단순하면서도 있어야할 기능이 있어서 좋다.
https://github.com/com-puter-tips/Links-Extractor @devharsh

Installation

python 코드이기 때문에 python3와 코드에서 import하는 라이브러리만 설치하면 된다.

dependencies

beautifulsoup4==4.11.1
requests==2.25.1

lxml이 없으면 아래와 같은 에러 메시지가 발생한다.
beautifulsoup에서 lxml 라이브러리를 사용하기 때문에 발생하는 것으로 보인다.

Couldn't find a tree builder with the features you requested: lxml. Do you need to install a parser library?


lxml 버전은 안 가리는 것 같다.

pip3 install lxml

download

git clone https://github.com/com-puter-tips/Links-Extractor

Examples

python3 extractor.py URL

내부 링크 출력

외부 링크 출력

profile
kyugyusinn

0개의 댓글