def echo(bot, update):
    """Echo the user message."""
    try:
        link = update.message.text
        reddit = Downloader()
        reddit.url = link
        reddit.path = ''
        reddit.overwrite = False
        reddit.max_q = True
        reddit.min_q = True
        reddit.max_d = 1e1000
        reddit.max_s = 1e1000
        reddit.auto_max = False
        reddit.proxies = {}
        path = reddit.download()
        bot.send_video(chat_id=update.message.chat_id, video=open(path, 'rb'), supports_streaming=True)
    except:
        bot.send_message(chat_id=update.message.chat_id, text="Failed")
Example #2
0
                      type=int,
                      default=1e1000)
optional.add_argument(
    '-am',
    '--automax',
    help=
    'Automatically download video with maximum size (Helps for old reddit videos with unknown qualities)',
    action='store_true')
optional.add_argument(
    '-px',
    '--proxies',
    help='Download videos through proxies for blocked regions',
    type=dict,
    default={})

args = parser.parse_args()

# Link arguments with Redvid
reddit = Downloader()
print(args)
reddit.url = args.url
reddit.path = ''
reddit.overwrite = False
reddit.max_q = True
reddit.min_q = True
reddit.max_d = 1e1000
reddit.max_s = 1e1000
reddit.auto_max = False
reddit.proxies = {}

reddit.download()
Example #3
0
import requests
import glob
import os.path
import os
import fnmatch

bot_token = ""
bot_chatID = ''
reddit = praw.Reddit(client_id="",
                     client_secret="",
                     user_agent="Centos:test_bot:v0.1.0")
an_hour_ago = datetime.utcnow() - timedelta(hours=1)
for submission in reddit.subreddit("tiktokthots").hot():
    if datetime.utcfromtimestamp(submission.created_utc) >= an_hour_ago:
        print(submission.url)
        reddit = Downloader(max_q=True)
        reddit.url = submission.url
        reddit.overwrite = True
        reddit.download()
        url = "https://api.telegram.org/bot" + bot_token + "/sendVideo"
        data = {"chat_id": bot_chatID}
        os.chdir("/root/bot_python/")
try:
    for video in glob.glob("*.mp4"):
        if not fnmatch.fnmatch(video, "*240.mp4"):
            files = {"video": open(video, "rb")}
            r = requests.post(url, files=files, data=data)
            print(r.status_code, r.reason, r.content)
except:
    pass
Example #4
0
                      type=int,
                      default=1e1000)
optional.add_argument(
    '-am',
    '--automax',
    help=
    'Automatically download video with maximum size (Helps for old reddit videos with unknown qualities)',
    action='store_true')
optional.add_argument(
    '-px',
    '--proxies',
    help='Download videos through proxies for blocked regions',
    type=dict,
    default={})

args = parser.parse_args()

# Link arguments with Redvid
reddit = Downloader()

reddit.url = args.url
reddit.path = args.path
reddit.overwrite = args.overwrite
reddit.max_q = args.maxquality
reddit.min_q = args.minquality
reddit.max_d = args.maxduration
reddit.max_s = args.maxsize
reddit.auto_max = args.automax
reddit.proxies = args.proxies

reddit.download()