GithubHelp home page GithubHelp logo

excloudx6 / youtuber Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 3.14 MB

Support tools including crawler, video editing, YouTube API, etc.

Home Page: https://pypi.org/project/youtuber/

Python 100.00%

youtuber's Introduction

Development Status :: 3 - Alpha
Copyright (c) 2023 MinWoo Park

Python Package: YouTuber

YouTuber Pypi Version Contributor Covenant Python Version Code convention Black Fomatter

Contains several useful features that can be used for youtube related projects. This package is intended to provide useful features for video editing, including crawling through the YouTube Data API v3 and Selenium.


Installation

pip install youtuber

Quick Start

  1. Install the Python package youtuber - pip install youtuber
  2. Obtain an API key for YouTube Data API v3 from the following link and enter it.
  3. Enter the path of chromedriver.exe.
  4. Enter the YouTube search keyword, the number of videos to crawl, and the number of comment pages to crawl.
  5. Enter the full path of the CSV file to be saved after execution. If encoding issues arise, please save the returned pd.DataFrame object separately.
from youtuber import AutoCrawler

DEVELOPER_KEY = "enter_your_dev_api_key"               # Enter your DEV API KEY at https://console.cloud.google.com/apis/api/youtube.googleapis.com/credentials?project=sincere-canyon-278402
CHOROME_PATH = r'C:\Program Files\chromedriver.exe'    # Enter path of 'chromdriver.exe' 

auto = AutoCrawler(DEVELOPER_KEY, CHOROME_PATH)
search_keyword = 'chatGPT'      # Youtube Search Keyword
max_link_len = 2                # How many videos you target to crawl?
max_comment_pg_len = 2          # How many comment pages you target to crawl?
save_path = './enter/any/path/result.csv'

df = auto.run(search_keyword, max_link_len, max_comment_pg_len, save_path)

Tutorial

  1. Main tutorial: https://github.com/DSDanielPark/youtuber/blob/main/docs/tutorial.ipynb
  2. Sub tutorial folder: Tutorials for each function can be found in this folder.

Features

1. YoutubeAPI

Retrieve YouTube search results.
You can get your 'Youtube Data API v3' key in here, and you can find some guide in here.

from youtuber import YoutubeAPI

DEVELOPER_KEY = "enter_your_api_key"
youtuber_v3 = YoutubeAPI(DEVELOPER_KEY)
links = youtuber_v3.get_links('chatGPT', 3) #YouTube Search Keyword = 'chatGPT', return 3 links.

links
['https://www.youtube.com/watch?v=xxxxx',
 'https://www.youtube.com/watch?v=xxxxx',
 'https://www.youtube.com/watch?v=xxxxx']

2. YoutubeCrawler

Retrieve comment data.

from youtuber import YoutubeCrawler

chrome_driver = r'C:\Program Files\chromedriver.exe'
youtuber_crawl = YoutubeCrawler(chrome_driver)
df = youtuber_crawl.get_comment_df(links, 1) #if you enter 1, only 1 page of comments will be searched.

df #You can get pd.DataFrame object.

3. AutoCrawler

Due to dependency issues, the AutoCrawler class was created separately without inheritance, but it includes both the YoutubeAPI and YoutubeCrawler methods. The AutoCrawler class performs both search functionality via the Youtube Data API v3 and comment crawling via Selenium.


References

[1] YouTube Data API v3: https://developers.google.com/youtube/v3/getting-started?hl=ko
[2] Selenium python: https://selenium-python.readthedocs.io/



Important Warning: All legal responsibilities associated with the use of the package lie with the user.

The Python package "youtuber" provides code for Python users to easily access data through the YouTube Data API v3 and Selenium. All licenses follow those of the API and dependent packages, and all responsibility for handling data and using the package lies with the user. There is no monetary compensation received for the use of this code, and it should be noted that there is no liability for the use of the code. Please refer to the YouTube Data API page for more details. https://developers.google.com/youtube/v3?hl=ko

youtuber's People

Contributors

dsdanielpark avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.