Reddit Bots: Difference between revisions
Jump to navigation
Jump to search
| (5 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
== OAuth2 == | |||
=== Register an app on Reddit === | |||
* Log in as the user who will be the owner of the app. | |||
* [https://www.reddit.com/prefs/apps] | |||
* 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 == | |||
The python [https://praw.readthedocs.io/en/stable/ `praw`] library that is a wrapper for the [https://www.reddit.com/dev/api/ Reddit API]. | |||
== Obscuring IP address == | == Obscuring IP address == | ||
| Line 18: | Line 35: | ||
* [https://smartproxy.com https://smartproxy.com] - residential proxies | * [https://smartproxy.com https://smartproxy.com] - residential proxies | ||
* [https://myprivateproxy.net https://myprivateproxy.net] - private proxies | * [https://myprivateproxy.net https://myprivateproxy.net] - private proxies | ||
=== Setting proxy in python === | |||
Proxy is determined by the `http_proxy` and `https_proxy` OS environment variable. | |||
<syntaxhighlight lang="python"> | |||
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 | |||
</syntaxhighlight> | |||
== See also == | == See also == | ||
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