Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

Python Can this be done? And if it can, how?

Seneca

Coder
I don't know Python. I would like to do the following:

BOT ONE:

  • When a YouTube video is uploaded, I would like the Reddit bot to post the YouTube video to a certain sub-reddit
    • I would like the bot to sticky the post and unsticky the previous video.
  • I would also like the bot to post to a sub-reddit when a tweet is posted.
    • The title of the post is the text contents of the tweet.
    • The Reddit post should be a link post.
BOT 2:

  • When someone uploads an image to Instagram, I would like the bot to post to a certain sub-reddit.
  • I would like the bot to upload the image to Imgur. Thus creating a mirror.
  • In the comments I want the bot to first sticky the comment then the following:
    • Post the Instagram image url
    • Post the mirror link
Ideally, I would like the code to be reusable so the bots can be extended to other sub-forums if need be.
 
Last edited:
I don't know Python. I would like to do the following:

BOT ONE:

  • When a YouTube video is uploaded, I would like the Reddit bot to post the YouTube video to a certain sub-reddit
    • I would like the bot to sticky the post and unsticky the previous video.
  • I would also like the bot to post to a sub-reddit when a tweet is posted.
    • The title of the post is the text contents of the tweet.
    • The Reddit post should be a link post.
BOT 2:

  • When someone uploads an image to Instagram, I would like the bot to post to a certain sub-reddit.
  • I would like the bot to upload the image to Imgur. Thus creating a mirror.
  • In the comments I want the bot to first sticky the comment then the following:
    • Post the Instagram image url
    • Post the mirror link
Ideally, I would like the code to be reusable so the bots can be extended to other sub-forums if need be.
I believe this is possible with the use of the respective API's, Although, to access the Twitter API you need to apply for a developers account.
I suggest you look up modules to make accessing the API's easier.
 
I don't know Python. I would like to do the following:

BOT ONE:

  • When a YouTube video is uploaded, I would like the Reddit bot to post the YouTube video to a certain sub-reddit
    • I would like the bot to sticky the post and unsticky the previous video.
  • I would also like the bot to post to a sub-reddit when a tweet is posted.
    • The title of the post is the text contents of the tweet.
    • The Reddit post should be a link post.
BOT 2:

  • When someone uploads an image to Instagram, I would like the bot to post to a certain sub-reddit.
  • I would like the bot to upload the image to Imgur. Thus creating a mirror.
  • In the comments I want the bot to first sticky the comment then the following:
    • Post the Instagram image url
    • Post the mirror link
Ideally, I would like the code to be reusable so the bots can be extended to other sub-forums if need be.
Its possible.
 
As others have said, you need to get a Twitter API key to send POST/GET requests for information.
I don't know much about it, but you will also need to learn the YouTube API
You will also need to register your bot on Reddit & use their API

You will need to send/receive data to Reddit & Twitter & YouTube
You will use a cron for your script to regularly check for new Tweets/YouTube videos to submit to reddit
 
As others have said, you need to get a Twitter API key to send POST/GET requests for information.
I don't know much about it, but you will also need to learn the YouTube API
You will also need to register your bot on Reddit & use their API

You will need to send/receive data to Reddit & Twitter & YouTube
You will use a cron for your script to regularly check for new Tweets/YouTube videos to submit to reddit
What about Instagram?
 
Oh, and another question. Is it possible to split a Instagram post and create multiple reddit threads? What I mean is, if a person uploads 4 images to a single Instagram post, would it be possible to get all 4 images?
 
Not sure how you would do it because I'm not sure what the API allows you to do. It should be possible though because you can just get the URLs for the images and split them into four variables etc.
 
This is what I have so far.
Python:
import praw
import tweepy


reddit = praw.Reddit(client_id="*",

                     client_secret="*",

                     user_agent="*",

                     username="*",

                     password="*")


consumer_key = '*'

consumer_secret = '*'

access_token = '*'

access_token_secret = '*'


auth = tweepy.OAuthHandler(consumer_key, consumer_secret)

auth.set_access_token(access_token, access_token_secret)


api = tweepy.API(auth)


base_url = 'https://twitter.com/'

mobole_prefix = 'mobile.'
[/CODE]
I plan on adding some stuff for config. I might use json
EDIT
JSON:
 {
  "Reddit": {
    "client_id": "",
    "client_secret": "",
    "user_agent": "",
    "username": "",
    "password": ""
  },
  "Twitter": {
    "consumer_key": "",
    "consumer_secret": "",
    "access_token": "",
    "access_token_secret": "",
    "base_url": "",
    "mobile_url": ""
  }
}
 
Last edited:
Back
Top Bottom