/FlibCartScraping

FlibCart scraping some products with pyhon beautiful soup library

Primary LanguagePythonMIT LicenseMIT

FlibCartScraping 🐧🌐

FlibCart website scrap laptops details with python beautifulSoup 4

Screenshot 2022-12-31 at 8 59 29 AM

Using BeautifulSaop Library To Scrap HTML 🐉 🚀

Beautiful Soup is a Python library for pulling data out of HTML and XML files. It works with your favorite parser to provide idiomatic ways of navigating, searching, and modifying the parse tree. It commonly saves programmers hours or days of work.

installtion using python package manager PIP

(venv) $ pip install beautifulsoup4 

Code Snipptes 👨🏿‍💻

# Looping for Laptops detials {title, price, ratings}
# append iterator ouput in Lists 
for iterator in document.findAll('a', href=True, attrs={'class': "_1fQZEK"}):
    name = iterator.find('div', attrs={'class': '_4rR01T'})
    price = iterator.find('div', attrs={'class': '_30jeq3 _1_WHN1'})
    rating = iterator.find('div', attrs={'class': '_3LWZlK'})
    products.append(name.text)
    prices.append(price.text)
    ratings.append(rating.text)

# Make use of pandas lib to generate output in Files.
outputDocument = pd.DataFrame(
    {'Product Name': products, 'Product Price': prices, 'Product Rating': ratings})
outputDocument.head()
outputDocument.to_csv('products.csv')  # generating csv file

Clone The Repository 🐛

git clone https://github.com/iNightjar/FlibCartScraping.git
cd FlibCartScraping
git checkout master
rm -rf .git
git init .
git branch [branch-name] # make it descriptive
git add [file]  # individual commits for each file are prefered
git commit -m "Your Commit Message"

Create virtual environment and activate it

python -m venv venv
source venv/bin/activate

Use .\venv\Scripts\activate if on windows

Install requirements

(venv) python -m pip install pip --upgrade
(venv) python -m pip install -r requirements.txt

Open VSCode & Start Coding

cd /path/Sclamp
code .