Skip to main content

A lightweight YouTube data scraper.

Project description

youthon

version licence made with love pypi

A lightweight YouTube data scraper.

Installing

pip

To install from PyPI with pip:

$ pip install youthon

poetry

You can add youthon as a dependency with the following command

$ poetry add youthon

Usage Examples

Fetching channels

import youthon

channel = youthon.Channel("https://www.youtube.com/@PewDiePie")

print(channel.name)  # PewDiePie
print(channel.description)  # I make videos.
print(channel.channel_url)  # https://www.youtube.com/channel/UC-lHJZR3Gqxm24_Vd_AJ5Yw
print(channel.profile_photo_url)  # https://yt3.googleusercontent.com/5oUY3tashyxfqsjO5SGhjT4dus8FkN9CsAHwXWISFrdPYii1FudD4ICtLfuCw6-THJsJbgoY=s900-c-k-c0x00ffffff-no-rj
print(channel.channel_id)  # UC-lHJZR3Gqxm24_Vd_AJ5Yw

# The following two variables may produce different results depending on your geolocation.
print(channel.subscribers_count)
print(channel.video_count)

print(channel.videos_page)  # https://www.youtube.com/channel/UC-lHJZR3Gqxm24_Vd_AJ5Yw/videos
print(channel.shorts_page)  # https://www.youtube.com/channel/UC-lHJZR3Gqxm24_Vd_AJ5Yw/shorts
print(channel.community_page)  # https://www.youtube.com/channel/UC-lHJZR3Gqxm24_Vd_AJ5Yw/community
print(channel.featured_channels_page)  # https://www.youtube.com/channel/UC-lHJZR3Gqxm24_Vd_AJ5Yw/channels
print(channel.playlists_page)  # https://www.youtube.com/channel/UC-lHJZR3Gqxm24_Vd_AJ5Yw/playlists
print(channel.about_page)  # https://www.youtube.com/channel/UC-lHJZR3Gqxm24_Vd_AJ5Yw/about

Fetching videos

import youthon

video = youthon.Video("https://youtu.be/XqZsoesa55w")

print(video.title)  #  Baby Shark Dance | #babyshark Most Viewed Video | Animal Songs | PINKFONG Songs for Children
print(video.description)  # a loooong description :)
print(video.author)  # Baby Shark - Pinkfong Kids’ Songs & Stories
print(video.video_url)  # https://www.youtube.com/watch?v=XqZsoesa55w

print(video.views)  # 14941899516
print(video.thumbnail_url)  #https://i.ytimg.com/vi/XqZsoesa55w/maxresdefault.jpg
print(video.date_published)  # 2016-06-17 16:00:30-07:00
print(video.legth_seconds)  # 136
print(video.isLiveContent)  # False
print(video.is_private)  # False
print(video.genre)  # Education

Fetching playlists

import youthon

playlist = youthon.Playlist("https://www.youtube.com/watch?v=K4DyBUG242c&list=PLRBp0Fe2Gpgm_u2w2a2isHw29SugZ34cD&ab_channel=NoCopyrightSounds")

print(playlist.title)  # NCS : The Top 100 Biggest Songs 📈
print(playlist.author.name)  # NoCopyrightSounds
print(playlist.total_videos)  # 100
print(playlist.playlist_id)  # PLRBp0Fe2Gpgm_u2w2a2isHw29SugZ34cD
print(playlist.playlist_url)  # https://www.youtube.com/playlist?list=PLRBp0Fe2Gpgm_u2w2a2isHw29SugZ34cD
print(playlist.video_urls)  # ['https://youtube.com/watch/?v=K4DyBUG242c', 'https://youtube.com/watch/?v=3nQNiWdeH2Q', 'https://youtube.com/watch/?v=J2X5mJ3HDYE', ... ]

About the project

Authors

Contributing

Contributions are always welcome!

See contributing.md for ways to get started.

Please adhere to this project's code of conduct.

License

The project is MIT licensed.

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

youthon-0.3.1.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

youthon-0.3.1-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file youthon-0.3.1.tar.gz.

File metadata

  • Download URL: youthon-0.3.1.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.1 Windows/10

File hashes

Hashes for youthon-0.3.1.tar.gz
Algorithm Hash digest
SHA256 a044d12f988d276e3d892005c0745844a9b5dd8069e26190a0c068a96b68557c
MD5 56515f0804058cdf90ff93f0f9a333b2
BLAKE2b-256 ffbbfe534cbaa6d23802141b6eb0d4cc6e33a72dd9115461b89b8237c4a63f95

See more details on using hashes here.

File details

Details for the file youthon-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: youthon-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.1 Windows/10

File hashes

Hashes for youthon-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 019c8319f423bc8631aa8300ce019be165b3875506817d19dab552e5203dfafd
MD5 cb0e5b4daa61a2a172e2b6e7f487dfc8
BLAKE2b-256 38bee6a41e1da7ff200333a69dda06ea5810431c8fd4be0ebe17fba9229fd508

See more details on using hashes here.

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