Package: nikescraperbykejora
Nike Scraper By KejoraA simple Python package for scraping detailed product information from the Nike Indonesia site (nike.com/id).Table of ContentsInstallationUsageContributingLicenseInstallationMake sure you have created a virtual environment before installing the package.To use this package, you need to install it in your Python virtual environment. You can do this using pip:pipinstall-UnikescraperbykejoraYou also need to install the following dependencies:pandas>=2.1.1;httpx>=0.25.0;playwright>=1.38.0;selectolax>=0.3.16;UsageDirectory StructureMake directory structure to use package as below:example_scraper/
├──result
├──main.py
├──.gitignore
└──README.mdScraping a Single ProductYou can scrape data for a single Nike product using the provided main.py script. See example below:Here's an example of how to use it. Scraping detail data of Nike Air Force 1 '07 with the url:https://www.nike.com/id/t/air-force-1-07-shoe-NMmm1B/DD8959-100So...the code for scraping in your main.py file as below.importasyncio
importos
fromnikescraperbykejora.scrapingresultimportProductScraperHandler


asyncdefmain():# User input for scraping one producttarget_url_one="https://www.nike.com/id/t/air-force-1-07-shoe-NMmm1B/DD8959-100"# Change with url you want to scrape, DON'T skip quotation mark (" ")txt_file_name="Nike Air Force 1 '07.txt"# Change with the name of product you want to scrape, DON'T skip .txt# Setting result directoryproject_directory=os.path.dirname(os.path.abspath(__file__))os.chdir(project_directory)result_directory=os.path.join(project_directory,"result")ifnotos.path.exists(result_directory):os.makedirs(result_directory)result_file_path=os.path.join(result_directory,txt_file_name)awaitProductScraperHandler.one_product(target_url_one,result_file_path)if__name__=="__main__":asyncio.run(main())Scraping Multi ProductYou can scrape data for some Nike products in product category using the provided main.py script. See example as below:On nike.com/id navbar you choose Men > Football > Shop by price Rp1.500.001 - Rp2.999.999, so below the data will be display
on the site:https://www.nike.com/id/w/mens-1500001-2999999-football-shoes-1gdj0z2952fznik1zy7okMulti Product Category Name : Men's Rp1.500.001 - Rp2.999.999 Football ShoesProduct count : 14 # It could be that when you try this URL, the product count value is differentAnd...the code for scraping in your main.py file as below.importasyncio
importos
fromnikescraperbykejora.scrapingresultimportProductScraperHandler


asyncdefmain():# User input for scraping multi productstarget_url_multi="https://www.nike.com/id/w/mens-1500001-2999999-football-shoes-1gdj0z2952fznik1zy7ok"# Change with url you want to scrapecsv_file_name="Men's Rp1.500.001 - Rp2.999.999 Football Shoes.csv"# Change with the name of product category you want to scrape, DON'T skip .CSVproduct_count=14# Change with product count that displayed on the pagetimeout_seconds=10# Change with a higher integer value if scraping fails due to timeout# Setting result directoryproject_directory=os.path.dirname(os.path.abspath(__file__))os.chdir(project_directory)result_directory=os.path.join(project_directory,"result")ifnotos.path.exists(result_directory):os.makedirs(result_directory)result_file_path=os.path.join(result_directory,csv_file_name)awaitProductScraperHandler.multi_product(target_url_multi,result_file_path,product_count,timeout_seconds)if__name__=="__main__":asyncio.run(main())WARNINGMake sure double quotation mark (" ") for url, .txt for single product file name, .csv for multi product file name.Scraping ResultThe scraping result will be saved in the 'result' directory that automatically appears after the scraping process is complete.ContributingIf you'd like to contribute to this project, please follow these steps:Fork the repository on GitHub.Create a new branch with a descriptive name.Make your changes and commit them.Push your changes to your fork.Submit a pull request to the original repository.LicenseThis project is licensed under GNU General Public License (GPL) - see the LICENSE file for details.