Exemple #1
0
def GetAndPrintUserUploads(username,date):
    yt_service = YouTubeService()
    uri = 'http://gdata.youtube.com/feeds/api/users/%s/uploads' % username
    feed=yt_service.GetYouTubeVideoFeed(uri)
    entries=[]
    for entry in feed.entry:
        published= dateutil.parser.parse(entry.published.text).astimezone(dateutil.tz.tzlocal())
        if published > date:
            entries+=[entry]
    return entries
      
  
cfg_file=MyConfigParser()
path_to_cfg = os.path.abspath(os.path.dirname(sys.argv[0]))
path_to_cfg = os.path.join(path_to_cfg, 'ytconfig.cfg')
cfg_file.read(path_to_cfg)

r = praw.Reddit(user_agent=cfg_file.get('reddit', 'user_agent'))
print 'Logging in as '+ cfg_file.get('reddit', 'username')
r.login(cfg_file.get('reddit', 'username'),
            cfg_file.get('reddit', 'password'))

youtubes=cfg_file.getlist("youtube", "channels")

 
with open("lastCheck","r") as f:
    lastUpdate=pickle.load(f)

print "Checking youtube for updates since %s" % lastUpdate

for youtube in youtubes:
Exemple #2
0
from yrconfigparser import MyConfigParser
import os
import sys
import praw
from datetime import datetime
import pickle

cfg_file = MyConfigParser()
path_to_cfg = os.path.abspath(os.path.dirname(sys.argv[0]))
path_to_cfg = os.path.join(path_to_cfg, 'banconfig.cfg')
cfg_file.read(path_to_cfg)

r = praw.Reddit(user_agent=cfg_file.get('reddit', 'user_agent'))
print 'Logging in as ' + cfg_file.get('reddit', 'username')
r.login(cfg_file.get('reddit', 'username'), cfg_file.get('reddit', 'password'))

bansub = r.get_subreddit(cfg_file.get('reddit', 'banSubreddit'))
checksub = r.get_subreddit(cfg_file.get('reddit', 'checkSubreddit'))

checksub_comments = checksub.get_comments(limit=999)
banned = []
for x in bansub.get_banned():
    banned += [x]
print(len(banned))
for x in checksub_comments:
    if x.author not in banned:
        try:
            print("Banning " + str(x.author))
            bansub.add_ban(x.author)
            banned += [x.author]
        except: