Last active
February 4, 2016 20:13
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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