npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@dvishal485/flipkart_scraper

v0.2.9

Published

Scrape Flipkart product details

Downloads

10

Readme

flipkart-scraper

Crates.io NPM Version Documentation GitHub issues Telegram GitHub license

Scrapes product details and searches on Flipkart.

Disclaimer: I am not affiliated or linked to flipkart in any way. This repository is an exploratory project and not meant for commercial use.


Features

  • Does not require any client id/secret or any other authorisation

  • Fetch product details from URL of product which includes

    • Product Name
    • Current and Original Price
    • User Rating
    • Stock avalibility
    • Flipkart Assured Product
    • Share URL (More presentable URL)
    • Seller Information (Seller Name and Rating)
    • Product Thumbnails
    • Highlights
    • Available Offers
    • Product Specifications
  • Search product on Flipkart from its query, giving the following details

    • Product Name
    • Product Link
    • Product Thumbnail
    • Current Price of Product
    • Original Price of Product

Example Usage

Navigate to examples for basic use cases.

NPM Package

NPM Package can be used to parse the contents of webpage to return a valid JSON object response.

Refer to examples/js_demo example for a quick overview of using the npm package.

The package can be installed with npm

npm i @dvishal485/flipkart_scraper
  • Fetching Product Details

    1. Fetch the product page using fetch API or axios or any other networking module.

    2. Parse the webpage content using the library.

      import flipkart_scraper from "@dvishal485/flipkart_scraper";
      
      const product_details = flipkart_scraper.parse_product_details(product_webpage);
      console.log(product_details);
  • Searching Products

    1. Fetch the search page (https://www.flipkart.com/search?q={query}) using fetch API or axios or any other networking module.
    2. Parse the webpage content using the library.
    import flipkart_scraper from "@dvishal485/flipkart_scraper";
    
    const search_result = flipkart_scraper.parse_search_results(product_webpage);
    console.log(search_result);

Rust Crate

  • Fetching Product Details

    Snippet to fetch and print product details from Flipkart using product's URL.

    use std::error::Error;
    use flipkart_scraper::{ProductDetails, Url};
    
    #[tokio::main]
    async fn main() -> Result<(), Box<dyn Error>> {
        let url = "https://www.flipkart.com/samsung-galaxy-f13-waterfall-blue-64-gb/p/itm583ef432b2b0c";
        let details = ProductDetails::fetch(Url::parse(url)?).await;
        println!("{:#?}", details);
        Ok(())
    }
  • Searching Products

    Snippet to search a particular product on Flipkart using a given query.

    use flipkart_scraper::ProductSearch;
    use std::error::Error;
    
    #[tokio::main]
    async fn main() -> Result<(), Box<dyn Error>> {
        let query = "samsung washing machine";
        let details = ProductSearch::search(query.into()).await;
        if let Ok(s) = details {
            println!("{:#?}\n\nTotal {} search results.", s, s.results.len());
        } else {
            println!("{}", details.unwrap_err());
        }
        Ok(())
    }

License

This Project is licensed under GNU General Public License (GPL-3.0).