Skip to content

A TypeScript-based web scraper that extracts supplement information from Examine.com. This tool uses Puppeteer for web scraping and provides structured data about various supplements, including their benefits, side effects, and scientific names.

Notifications You must be signed in to change notification settings

FCimendere/nutrish-case-implementation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nutrish Case Implementation

A TypeScript-based web scraper that extracts supplement information from Examine.com. This tool uses Puppeteer for web scraping and provides structured data about various supplements, including their benefits, side effects, and scientific names. The output contains limited data as would occur in console JSON output.

Features

  1. Web scraping of supplement information from Examine.com
  2. Input validation using Zod
  3. Structured data output with TypeScript interfaces
  4. Headless browser automation using Puppeteer
  5. Error handling and logging

This project is working on main and nutrish-scraper branches for minimum requirements.

The nutrish-ai-chatbot branch provides some additional steps for chatbot AI applications for preferred pequirements. Especially creating API via Vercel. However, this part is not fully completed.

Prerequisites

  • Node.js (LTS version recommended)
  • npm or yarn package manager
  • TypeScript knowledge for development

Installation

  1. Clone the repository:
  2. git clone https://github.com/FCimendere/nutrish-case-implementation.git
    cd nutrish-case-implementation
    
  3. Install dependencies:
  4. npm install
    

Usage

Running the Scraper

You can run the scraper using the following command:

npm run scrape

Or directly with ts-node:

npm run start

Example Output Structure

The scraper returns data in the following format:

typescriptCopyinterface SupplementData {
  name: string;
  scientificName: string;
  overview: string;
  benefits: string[];
  sideEffects: string[];
  otherNames: string[];
}

Project Structure

├── src/
│   ├── interfaces/
│   │   └── supplement.interface.ts
│   ├── services/
│   │   └── scraper.service.ts
│   └── index.ts
├── package.json
└── tsconfig.json

Technical Details

  • Built with TypeScript for type safety
  • Uses Puppeteer for browser automation
  • Implements Zod for input validation
  • Configured with strict TypeScript settings
  • Includes proper error handling and logging

Development

To build the project:

npm run build

The compiled JavaScript files will be output to the dist directory.

Dependencies

  • puppeteer: Web scraping and browser automation
  • zod: Runtime type checking and validation
  • typescript: Static type checking
  • ts-node: TypeScript execution environment

Notes

  • This scraper is designed for educational purposes
  • Please respect Examine.com's terms of service and rate limiting
  • Ensure proper error handling when using in production

Vercel API Integration Improvements

The project can scrape on Puppeteer and Typescript as a backend service. For better performance, the backend can be turned into an API endpoint via VERCEL as a Backend Project. The user can simply enter the word they want to search next to the Vercel link and perform a query query. The Vercel AI chatbot starter project at https://github.com/vercel/ai-chatbot can be run locally or deployed on Vercel. Then this API response can be sent to the Chatbot.

API Endpoint Structure

  • Convert to Vercel Serverless Functions

API Features:

  • CORS Configuration
  • API Authentication

Environment Setup:

  • Vercel Configuration
  • Required Dependencies
  • Frontend Integration

License

ISC

Author

[Fulya Cimendere]

Note: This project is not affiliated with Examine.com and is for educational purposes only.

About

A TypeScript-based web scraper that extracts supplement information from Examine.com. This tool uses Puppeteer for web scraping and provides structured data about various supplements, including their benefits, side effects, and scientific names.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published