This Python script allows you to scrape data from a given URL and search for specific keywords within the text content. It returns the count of how many times each keyword appears in the text.
- Web scraping: Fetches the HTML content from the specified URL
- Keyword search: Searches for the given keywords in the text content of the webpage
- Case-insensitive search: Keywords are matched without considering case
-
Clone this repository:
git clone https://github.com/nipun014/webscraping.git
-
Navigate to the project directory:
cd your-repository
-
Install the required libraries:
pip install requests beautifulsoup4
-
Run the Python script:
python test.py
-
Enter the following details when prompted:
- The URL you want to scrape
- The number of keywords you want to search
- The keywords themselves
-
The script will output the number of times each keyword appears in the text content of the webpage.
Enter URL: https://example.com
Enter number of keywords: 2
Enter keyword 1: Python
Enter keyword 2: Web scraping
Keyword search results:
'Python': 5 occurrences
'Web scraping': 3 occurrences
- Python 3.x
- requests library
- beautifulsoup4 library