Skip to main content
100%

파이썬으로 웹 크롤러 만들기_4장_097쪽 예제 전체 코드

✓ Published0🌍 Public
Aanemochore
Last edited Jan 5, 2017
Created on Dec 28, 2016

This example demonstrates a web crawler that traces Wikipedia article revision histories and maps contributor IP addresses to country codes, printing each IP and its originating country. The code uses Python’s `urllib.request` to fetch pages, BeautifulSoup to parse HTML links and extract anonymous user IPs from the `mw-anonuserlink` class, and the freegeoip.net API to geolocate each IP via JSON responses. It randomly selects new article links from the parsed body content to continue the crawl, filtering out non-article URLs with a regex pattern.

AI-generated description

Similar vizzes