Skip to content

Instantly share code, notes, and snippets.

@chowmean
Last active February 4, 2016 20:13
Show Gist options
  • Select an option

  • Save chowmean/9d1e69d91acb8d8e4e58 to your computer and use it in GitHub Desktop.

Select an option

Save chowmean/9d1e69d91acb8d8e4e58 to your computer and use it in GitHub Desktop.

Revisions

  1. chowmean revised this gist Aug 21, 2015. No changes.
  2. chowmean created this gist Aug 21, 2015.
    38 changes: 38 additions & 0 deletions getyoutubecomment.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,38 @@
    # Author: chowmean
    # simple python script to get the comment of youtube videos using google apis get method
    # Date: 21:08:2015
    # mail: gaurav.dev.iiitm@gmail.com
    # github:github.com/chowmean
    #


    import oauth2
    import time
    import urllib2
    import json
    import requests

    url= "https://www.googleapis.com/youtube/v3/commentThreads"
    params=dict()


    api_key='Your_API_KEY'
    videoId='pxofwuWTs7c'

    params["part"] = "snippet" #mandatory
    params["maxResults"] = "50" #optional
    params["textFormat"] = "plainText" #or html
    params["videoId"] = videoId

    params["key"] = api_key
    url=url+'?'
    i=0
    for key,value in params.iteritems():
    if i==0:
    url=url+key+'='+value
    i=i+1
    else:
    url=url+'&'+key+'='+value
    print url
    resp=requests.get(url)
    print resp.content