GithubHelp home page GithubHelp logo

youtube-community-posts's Introduction

youtube-community-posts

Fetch youtube community posts contents and comments

Methods

  • fetchPosts(channel_id, limit=10)

Fetches all community posts from a channel specified.

channel_id -> ID of the youtube channel to fetch from.

limit -> The number of posts to fetch. Default is 10.


  • fetchPost(channel_id, postParam)

Fetch a community post data with its postParam obtained from fetchPosts.

channel_id -> ID of the youtube channel to fetch from.

postParam -> postParam obtained from fetchPosts.


  • fetchComment(commentToken, limit=20, reply=False)

Fetch a comment from fetchPost comments results.

commentToken -> commentToken from fetchPosts.

limit -> The number of comments to fetch. Default is 20.

reply -> True if the supplied comment token is token from single fetchComment result.


Fetching result as authenticated account

  1. Open incognito browser and open developer console.
  2. Browse to network tab and enable Preserve log.
  3. Type in set_registration in the network search bar.
  4. Go to https://www.youtube.com/ and login as usual.
  5. Then select the 2nd result and then copy the whole cookie from the request headers.
  6. Pass the cookie when creating the object. Example:
from yTposts import YT_Posts
yt = YT_Posts(cookie_string)

Example Usage

from yTposts import YT_Posts

channel_id = "UC47rNmkDcNgbOcM-2BwzJTQ"
yt = YT_Posts()
community_posts = yt.fetchPosts(channel_id, limit=2)
single_community_post = yt.fetchPost(channel_id, community_posts[0]["postParams"])
comments = yt.fetchComment(single_community_post["commentToken"], limit=999)
replies_to_comment = yt.fetchComment(comments["comments"][0]["replyToken"], reply=True)

youtube-community-posts's People

Contributors

neppu-nep avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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.