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.
Simple python script to get youtube comments using google api and requests. :D havefun
# 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment