class StreamableUpload(object):
    def __init__(self):
        load_dotenv()
        USERNAME = os.getenv('STREAMABLE_USERNAME')
        PASSWORD = os.getenv('STREAMABLE_PASSWORD')
        self.streamable = StreamableApi(USERNAME, PASSWORD)

    def __call__(self, filepath):
        self.streamable.upload_video(filepath)
Ejemplo n.º 2
0
def upload_to_streamable(path):
    username = os.environ.get("username")
    password = os.environ.get("password")
    api = StreamableApi(username, password)
    deets = api.upload_video(path, path.split('/')[-1])
    count = 0
    while True:
        count += 1
        test = api.get_info(deets['shortcode'])
        if test['percent'] == 100:
            break
        elif count == 6:
            exit()
        else:
            time.sleep(10)
    return "https://streamable.com/" + deets['shortcode']
Ejemplo n.º 3
0
def upload(config, tmp_dir):
    print('Uploading screens and sample videos...')
    links = {}
    imgur_client_id = config['imgur_client_id']
    imgur = Imgur(imgur_client_id)
    for i in range(1, 5):
        file = f'screen-0{i}.jpeg'
        path = os.path.join(tmp_dir, file)
        try:
            links[file] = imgur.upload_image(path).link
        except:
            sys.exit('Error uploading to Imgur! Exiting.')
    streamable_username = config['streamable_username']
    streamable_password = config['streamable_password']
    streamable = StreamableApi(streamable_username, streamable_password)
    for i in range(1, 3):
        file = f'sample-00{i}.mkv'
        path = os.path.join(tmp_dir, file)
        try:
            links[
                file] = f'https://streamable.com/{streamable.upload_video(path)["shortcode"]}'
        except:
            sys.exit('Error uploading to Streamable! Exiting.')
    return links
 def __init__(self):
     load_dotenv()
     USERNAME = os.getenv('STREAMABLE_USERNAME')
     PASSWORD = os.getenv('STREAMABLE_PASSWORD')
     self.streamable = StreamableApi(USERNAME, PASSWORD)
Ejemplo n.º 5
0
import praw
import secret
import urllib
import re
import psutil

from bs4 import BeautifulSoup
from pystreamable import StreamableApi
from moviepy.editor import *
api = StreamableApi(secret.email, secret.streamable_pass)

reddit = praw.Reddit(client_id=secret.client_id,
                     client_secret=secret.client_secret,
                     user_agent=secret.user_agent,
                     username=secret.username,
                     password=secret.password)

print("Bot starting up...")
#print(reddit.read_only)


def ScrapeImgurVideo(link_id, mention_id):
    submission = reddit.submission(id=link_id)
    print(submission.media['oembed']['url'])
    imgurUrl = str(submission.media['oembed']['url'])
    imgurPage = urllib.request.urlopen(imgurUrl)
    imgurSoup = BeautifulSoup(imgurPage, 'html.parser')

    videoContainer = imgurSoup.find('meta', attrs={'property': 'og:video'})
    videoLink = re.findall('"([^"]*)"', str(videoContainer))[0]
Ejemplo n.º 6
0
 def upload_file_streamable(self,input_name):
     r = StreamableApi("username", "KEY").upload_video(input_name, input_name)
     return "https://streamable.com/" + r["shortcode"]
Ejemplo n.º 7
0
REDDIT_API = praw.Reddit(client_id=REDDIT_CLIENT_ID,
                         client_secret=REDDIT_CLIENT_SECRET,
                         password=REDDIT_PASSWORD,
                         redirect_uri=REDDIT_REDIRECT_URL,
                         user_agent=REDDIT_USER_AGENT,
                         username=REDDIT_USER_NAME)

TWITTER_AUTH = tweepy.OAuthHandler(TWITTER_CONSUMER_KEY,
                                   TWITTER_CONSUMER_SECRET)
TWITTER_AUTH.set_access_token(TWITTER_ACCESS_TOKEN_KEY,
                              TWITTER_ACCESS_TOKEN_SECRET)
TWITTER_API = tweepy.API(TWITTER_AUTH)

IMGUR_API = pyimgur.Imgur(IMGUR_CLIENT_ID)

STREAMABLE_API = StreamableApi(STREAMABLE_USERNAME, STREAMABLE_PASSWORD)


class GenerateReply:
    """Generate a reply.

    :param tweet: Tweet object.
    """
    def __init__(self, tweet):
        self._tweet = tweet
        self.header_media = ''
        self.reply_body = self.body()

    def body(self):
        """Reply body template."""
        date_time = datetime.datetime.strptime(str(self._tweet.created_at),
Ejemplo n.º 8
0
client_id = os.getenv('CLIENT_ID')
client_secret = os.getenv('CLIENT_SECRET')
username = os.getenv('USERNAME')
password = os.getenv('PASSWORD')
user_agent = os.getenv('USER_AGENT')
streamable_email = os.getenv('STREAMABLE_EMAIL')
streamable_password = os.getenv('STREAMABLE_PASSWORD')
Client = discord.Client()
bot_prefix = "!"
client = commands.Bot(command_prefix=bot_prefix)
reddit = praw.Reddit(client_id=client_id,
                     client_secret=client_secret,
                     username=username,
                     password=password,
                     user_agent=user_agent)
api = StreamableApi(streamable_email, streamable_password)
vid_str = None
embedVar = None


@client.event
async def on_ready():
    print("Bot Online")
    print("Name: {}".format(client.user.name))
    print("ID: {}".format(client.user.id))


@client.command()
async def embedVid(ctx, link):
    global vid_str
    submission = reddit.submission(url=link)
Ejemplo n.º 9
0
import urllib
import os.path
from urllib.request import urlretrieve
import json
from imgurpython import ImgurClient
from pystreamable import StreamableApi
import slideshow
import logging

if __name__ == "__main__":
    logging.basicConfig(level=logging.INFO,
                        filename="logfile",
                        filemode="a+",
                        format="%(asctime)-15s %(levelname)-8s %(message)s")

streamApi = StreamableApi(config.streamusername, config.streampass)
subList = [
    'Pictures',
    'pics',
    'PhotoshopBattles',
    'Ireland',
    'Europe',
    'Melbourne',
    'france',
    'denmark',
    'italy',
    'norge',
    'polska',
    'de',
    'suomi',
    'romania',