Download src/url_fetcher.py from Chemically-motivated/OSINT_Tool: direct link, hf CLI and curl.
- Browser
- Download file 428 Bytes
-
https://huggingface.co/spaces/Chemically-motivated/OSINT_Tool/resolve/61560c50b8652e24009065dec0469ff40698905c/src/url_fetcher.py
- Command line
-
hf download hf://spaces/Chemically-motivated/OSINT_Tool@61560c50b8652e24009065dec0469ff40698905c/src/url_fetcher.py
-
curl -L -o url_fetcher.py https://huggingface.co/spaces/Chemically-motivated/OSINT_Tool/resolve/61560c50b8652e24009065dec0469ff40698905c/src/url_fetcher.py
428 Bytes
| import requests | |
| import re | |
| def fetch_url_title(url): | |
| try: | |
| response = requests.get(url) | |
| if response.status_code == 200: | |
| match = re.search('<title>(.*?)</title>', response.text) | |
| if match: | |
| return match.group(1) | |
| else: | |
| return None | |
| else: | |
| return None | |
| except Exception as e: | |
| print(f"Error: {e}") | |
| return None | |