Skip to main content

ytanalysis

ytanalysis is a Python package designed to analyze YouTube channel statistics using the YouTube Data API. With this package, you can retrieve information about a YouTube channel, including subscriber count, video details, views, likes, comments, and more. It also provides visualization tools to help analyze video views and monthly posting frequency.

Features

  • Retrieve detailed YouTube channel statistics (subscribers, views, total videos, etc.)
  • Extract video statistics such as views, likes, and comments
  • Export video data to a CSV file for further analysis
  • Generate visualizations for top-performing videos and monthly posting frequency

Installation

To install this package, use pip:

pip install ytanalysis

## Prerequisites

You need a YouTube Data API key to use this package. Follow these steps to obtain one:

1. Go to the [Google Cloud Console](https://console.cloud.google.com/).
2. Create a new project (or select an existing one) and navigate to **APIs & Services** > **Library**.
3. Search for "YouTube Data API v3" and enable it for your project.
4. Go to **APIs & Services** > **Credentials** and create an API key.
5. Copy the API key for later use.

## Usage

### Initialization

To initialize the `YTAnalysis` class, replace `YOUR_YOUTUBE_API_KEY` with your actual API key and `CHANNEL_URL` with the YouTube channel URL you want to analyze:

```python
from ytanalysis import YTAnalysis

api_key = "YOUR_YOUTUBE_API_KEY"
channel_url = "https://www.youtube.com/channel/CHANNEL_ID"

yt = YTAnalysis(channelURL=channel_url, apikey=api_key)


### Methods

#### Get Channel Details

```python
channel_info = yt.getChannelDetail()
print(channel_info)

#### Get Video Details
```python
video_details = yt.getVideoDetail()
print(video_details)

#### Export Details
```python
yt.export_csv()

#### Plot Views
```python
yt.plotViews(values=10, mostViewed=True, save=False)

#### Plot View Count
```python
yt.plotVideoCount(save=False)

Metadata

Release files for ytanalysis 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ytanalysis 0.1.0
File Size Uploaded
ytanalysis-0.1.0.tar.gz 3.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ytanalysis 0.1.0
File Interpreter ABI Platform
ytanalysis-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.7 kB

Release files / ytanalysis-0.1.0.tar.gz

Download URL ytanalysis-0.1.0.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
df119c32f0f861be0eaf018dbbecda0bdf4e6355c08b4dd9fa4d3b1179d5bd6c
BLAKE2b-256 checksum
How to use checksums
ef11e906b2cee5f667e0bbc5ad6152cbe0f54224e281bd508c485e336b4a01ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.4

Release files / ytanalysis-0.1.0-py3-none-any.whl

Download URL ytanalysis-0.1.0-py3-none-any.whl
Size 4.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3e38f97ec7a829e2aa89e1c682fc6de65e028bd3bad796c6afa6492f6bd0d457
BLAKE2b-256 checksum
How to use checksums
aa238dc33e2b1dd6235dbad831c47736f0b6f50e98d491157882de284ce3d206
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.4

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page