Giter Site home page Giter Site logo

psreddit's Introduction

PSReddit

This is a set of tools for browsing Reddit using the Powershell command line.

Installation

  • Copy the "PSReddit" folder into your module path. Note: You can find an appropriate directory by running $ENV:PSModulePath.Split(';').
  • Run Import-Module PSReddit from your PowerShell command prompt.

Usage

Register for a Reddit API account here, Reddit Application Preferences, and choose a Script based Application. Make note of your ClientSecret, ClientID and RedirectURI (which can be anything). Copy these values

###Connecting your Account### Connect-RedditAccount -ClientID $clientID -redirectURI $redirectURI -force -ClientSecret $ClientSecret #oAuth Window will be displayed

approve oAuth and away you go!

Credentials persist in secure storage and are automatically imported when you use a cmdlet in this module.

Once connected, you can connect to any of the endpoints listed in the Reddit API Documentation here.

Get-RedditAccount

name               : 1RedOne
hide_from_robots   : False
gold_creddits      : 0
link_karma         : 2674
comment_karma      : 19080
over_18            : True
is_gold            : False
is_mod             : False
gold_expiration    : 
has_verified_email : True
inbox_count        : 2
Created Date       : 1/20/2010 6:44:21 PM

... gets you information about your account including karma and account creation date

####Links####

Most of these are out of date with the new Rest method, and will be revamped

Get-RedditPost

... gets you a nicely formatted table of the current front page links.

Get-RedditLink -r Powershell

... does the same but for the subreddits listed.

Get-RedditLink -r Powershell | Where is_self | Format-List title, selftext | Out-Host -Paging

... will let you read the front-page self posts from the Powershell subreddit, in a nicely paginated format.

$top =  Get-RedditLink | Sort -Descending score 
$top[0].OpenUrl()

... will open the link with the top score on the front page in your default browser

###Comments - coming soon!###

Get-RedditLink | Get-RedditComment

... gets you all the top-level comments of all the posts on the front page

$top[0] | Get-RedditComment

... gets you the comments on just that top post

##Authentication##

<<<<<<< HEAD Connect-RedditAccount Get-RedditAccount Disconnect-RedditAccount - coming soon

======= Authentication is handled using oAuth via two private function cmdlets, Show-oAuthWindow being the most important of the two. If you've got another project and you're here because you need some reference for handling oAuth using PowerShell, this will be the cmdlet you want. It's found in the Module\Private folder. Connect-RedditAccount

origin/master ... logs you in, gets information about the logged in user, then logs out.

###To come###

  • Making Posts
  • imgur uploads
  • Your suggestions?
  • Multiple Account Support

psreddit's People

Contributors

1redone avatar kreloc avatar petterbomban avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.