Skip to main content

YouTube channel & video details extractor

Project description

YTchannel

YouTube channel & video details extractor

Features

Retrieve:-

  • Youtube Video downloader
  • Youtube Channel details
  • Youtube Video details

Requirements

You need to install requests module

pip install requests

Installation

pip install YTchannel

Importing

import YTchannel as yt

To Download Videos

download = yt.YTdownloader()

Initialize video extraction

try:
  download.startDownload(video_url=video_url,video_id = video_id)
except KeyError:
  #Invalid video id
except ConnectionError:
  #Connection error
except IndexError:
  #Can't find video
except:
  #Something went wrong

Get Result

result = download.getResults()

For Channel details

channel = yt.Channel()

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:
  channel.startChannel(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 = channel.getChannel() #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

print(result) #this will print all the details of a channel in a dictionary

For video details

video = yt.Video()

Calling with a Id and API key

The first parameter must be the video id or video_url Check below example https://www.youtube.com/watch?v=video_id here in this example the video id is video_id

try:
  video.startVideo(video_url=video_url,video_id = video_id,YOUR_API_KEY)
except KeyError:
  #Invalid video id
except ConnectionError:
  #Connection error
except:
  #Something went wrong

Check if the request is success

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

How to get details

print(resultVideo) #this will print all the details of a video in a dictionary

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.1.0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

YTchannel-0.1.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file YTchannel-0.1.0.tar.gz.

File metadata

  • Download URL: YTchannel-0.1.0.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for YTchannel-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2967f74a2e9c405d117e8dec0990fb65de49607d5f72b6fca74a3ca086b24f59
MD5 ab7d1059dead6205c380ea91500be672
BLAKE2b-256 f98b5b021758cf2a90656a538fac561024c054166f2cf655824ec425889485b5

See more details on using hashes here.

File details

Details for the file YTchannel-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: YTchannel-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2

File hashes

Hashes for YTchannel-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a06650ff0ae432a29213243472d7efdfe3370df0c1e4ec2fe970b7eadee05b28
MD5 3365ee5b9de0a3de655285d35f38ff68
BLAKE2b-256 c73d08d277c539c84b696bcbe6a4385e865c212e676e39d319bf6f3b5c1d9d3a

See more details on using hashes here.

Supported by

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