Reddit Bots: Difference between revisions
Jump to navigation
Jump to search
| (One intermediate revision by the same user not shown) | |||
| Line 37: | Line 37: | ||
=== Setting proxy in python === | === Setting proxy in python === | ||
Proxy is determined by the `http_proxy` and `https_proxy` OS environment variable. | |||
<syntaxhighlight lang="python"> | <syntaxhighlight lang="python"> | ||
Latest revision as of 14:42, 30 April 2022
OAuth2[edit]
Register an app on Reddit[edit]
- Log in as the user who will be the owner of the app.
- [1]
- Click Create Another App...
- Fill out the form.
- Select personal use script if this app will run locally. This can't be changed later and the authentication is different for each kind of app, so a web app's credentials can't be used in a script app context.
- Click Save App to generate a Client Id and Client Secret for the app.
The Client Id is displayed in the list of apps. The secret can be retrieved by clicking the Edit link by the app in the listings.
PRAW[edit]
The python praw library that is a wrapper for the Reddit API.
Obscuring IP address[edit]
Bot through proxy instead of VPN. [1]
- Proxies are faster than VPNs.
- A VPN is a single connection, so still a single IP.
- Proxies allow multiple connections at once, so many IPs.
Acquiring proxies[edit]
Things to look up: residential vs private proxies.
Don't know if this site is legit or not but there is info here: Best Reddit Proxies of 2022 - Best Proxy Reviews
Some suggestions to follow up on:
- https://proxy.webshare.io - random reddit user recommends them for price
- https://smartproxy.com - residential proxies
- https://myprivateproxy.net - private proxies
Setting proxy in python[edit]
Proxy is determined by the http_proxy and https_proxy OS environment variable.
import os proxy = 'http://<user>:<pass>@<proxy>:<port>' os.environ['http_proxy'] = proxy os.environ['HTTP_PROXY'] = proxy os.environ['https_proxy'] = proxy os.environ['HTTPS_PROXY'] = proxy
See also[edit]
External links[edit]
- Reddit API - Reddit documentation
- PRAW library - The Python Reddit API Wrapper
- How to Make a Reddit Bot - Yojji.io Blog