Python Prompts Free Prompt

Python Script to Extract URLs from a Webpage

Write a Python script that extracts all URLs from a given webpage
☆ Save
Prompt
You are a Python developer. Write a script that uses requests and BeautifulSoup to extract all links from a webpage. The script must: 1) Accept URL, 2) Find all <a> tags, 3) Extract href attributes, 4) Convert relative URLs to absolute, 5) Filter by domain (internal/external), 6) Save to file, 7) Handle encoding and errors. Add comments.

How to use this prompt

1
Click Copy Prompt above to copy to your clipboard.
2
Open ChatGPT, Claude, Gemini, or any AI assistant and paste the prompt.
3
Replace any [PLACEHOLDER] values with your specific details.
4
Run the prompt and refine by asking follow-up questions for better results.