Skip to main content

YouTube channel details extractor

Project description

YTchannel

YouTube channel details extractor

Features

Retrieve:-

  • Youtube Channel name
  • Icon, Channel art
  • Subs if not hidden
  • List no. of videos

Requirements

You need to install requests module

pip install requests

Installation

pip install YTchannel

Importing

from YTchannel.YTchannel import YTchannel

Creating an Object

yt = YTchannel()

Calling with a Id and API key

The first parameter must be the Channel id Check below example https://www.youtube.com/channel/UC_channel_id here in this example the channel id is UC_channel_id

try:
  yt.start(UC_channel_id,YOUR_API_KEY)
except KeyError:
  #Invalid channel id
except ConnectionError:
  #Connection error
except:
  #Something went wrong

Check if the request is success

result = yt.getResult() #this will return all details in a dictionary
if result['result'] == 'OK':
  #No problem do your thing
else:
  #Something wrong like - no channel found or invalid api key
  #use result['code'] to get the error code or result['message'] to know the message

How to get details

title = result['title'] #or use title = yt.title
des = result['des'] #or use des = yt.des
icon = result['icon'] #or use icon = yt.icon
subs = result['subs'] #or use subs = yt.subs
channelArt = result['channelArt'] #or use channelArt = yt.channelArt
videos = result['videos'] #or use videos = yt.videos
subhidden = result['subs_hidden'] #or use subhidden = yt.subhidden
country = result['country'] #or use country = yt.country

Any issues?

Create an issue on github

Contact me

Happy coding

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

YTchannel-0.0.5.tar.gz (3.2 kB view hashes)

Uploaded Source

Built Distribution

YTchannel-0.0.5-py3-none-any.whl (4.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page