๐Ÿ“– Python Web Scraping /
Module: Web Scraping

Finding the URL

๐Ÿ“– Python Web Scraping / Web Scraping / Finding the URL

Example: Searching DuckDuckGo search engine

DuckDuckGo search engine allows going to the first search result by adding an exclamation mark (!) in the query string. We will use this feature to create a Python script.
import webbrowser

query = input("Please input search query to search DuckDuckGo and go to first result. ")

url = f"https://duckduckgo.com?q=!+{query}"

webbrowser.open(url)