Skip to main content
Topic: R2YS a script for reddit (Read 2419 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

R2YS a script for reddit

/*Disclaimer
 *
 *The usage of this script must comply with the Reddit API Terms of Use
 *https://www.reddit.com/wiki/api
 *I will not be responsible for any modifications of the script made by the end users that do not comply with the terms.
 *
 *Credits:
 *Original concept (Subreddit to YouTube Source Bookmarklet) from https://gist.github.com/akaleeroy/b3de63c46ee43d413913
 *
 *Description:
 *Search subreddits for youtube/vimeo/spotify url's and create a playlist within foobar2000.
 *
 *Required components:
 *JScript Panel (http://www.foobar2000.org/components/view/foo_jscript_panel) and
 *Youtube Source (http://fy.3dyd.com/download/)
 *foo_input_spotify (https://github.com/stengerh/foo_input_spotify) Spotify support for foobar2000. Requires a Spotify premium account.
 *
 *Optional components:
 *m-tags (http://www.foobar2000.org/components/view/foo_tags)
 *
 *Installation:
 *Create an empty jscript panel and import the script.
 *Modify the script with your oauth2 credentials / or add them in the jscript panel properties.
 *username and password are your reddit credentials.
 *You must authorize with your account @ https://www.reddit.com/prefs/apps/ as your personal script to get your client_id  and client_secret keys.
 *See https://github.com/reddit/reddit/wiki/OAuth2 , https://github.com/reddit/reddit/wiki/OAuth2-Quick-Start-Example
 *
 * example:
 * var username = window.GetProperty("Reddit.username", "redditusername");
 * var password = window.GetProperty("Reddit.password", "redditpassword");
 * var client_id = window.GetProperty("Reddit.client_id", "redditclientid");
 * var client_secret = window.GetProperty("Reddit.client_secret", "redditsecret");
 *
 */





Re: R2YS a script for reddit

Reply #1
Tried it, works, thanks!  8)

Re: R2YS a script for reddit

Reply #2
Version 0.0.2

ADDED:  Search by query.
ADDED:  Visit Reddit comments for current playing item
CHANGE: Made Spotify optional component

Re: R2YS a script for reddit

Reply #3
Script no longer works nowadays. I get this:


Reloading or fiddling with the config doesn't help.

Re: R2YS a script for reddit

Reply #4
It it still working  with JScript Panel v.1.3.0
Can you provide an output from the console panel where it crashes?

Re: R2YS a script for reddit

Reply #5
Quote
It it still working  with JScript Panel v.1.3.0
Same version here. Something else was wrong with my config, because another JScript panel crashes too (YouTube Track Manager).

Found the relevant log info:
Code: [Select]
JScript Panel: This component requires your system has IE9 or later installed.

So the solution is to install Internet Explorer 9 or later.


Re: R2YS a script for reddit

Reply #7
@zeremy,
great job
I.m. UR5EQF

Re: R2YS a script for reddit

Reply #8
@zeremy
foo_jscript_panel introduced breaking changes in v2.0.0 that require updating your script:

Quote
fb.Trace has been removed and replaced with a native console.log method so you'll need to do a simple find/replace in all your scripts. It takes multiple arguments as before.

window.GetColorCUI -> window.GetColourCUI
window.GetColorDUI -> window.GetColourDUI


Re: R2YS a script for reddit

Reply #10
Some hints for installation for the 'non-experts':

- foo_input_spotify or a Spotify Premium Account is not required

- to get the reddit credentials:
     - register at reddit to get username and password
     - to get client_id and client_secret:
          - click here: https://www.reddit.com/prefs/apps/
          - in the template fill any name at the field 'Name'
          - check 'script'
          - Type any description
          - leave 'about url' blank
          - at 'redirect url' type 'http://107.0.0.1:65010/authorize_callback'  (that did at least work for me, don't ask me why)
          - then confirm and you see something like this:
             
            - the red underline string is the client_secret, the string 'p-jcoL...' right to the app icon on top of the page is the client_id
            - then include username, password, client_id, client_secret in the header of the js code as described by zeremy

- when first using the code the script crashed. Fix: I had to create the folder media\r2ys manually in my foobar directory (using portable installation)
- then the plugin worked great  :)
- in my skin the panel appeared to be white text on white background (referring only to status message, left-click reddit functions worked well). Fix: underlying PSS with black background and click 'pseudo-transparent' in the js panel

And then: enjoy ;D Thanks to zeremy!

 


Re: R2YS a script for reddit

Reply #11
Updated to Jscript Panel v2+

I didn't have the media folder in fb.ProfilePath and it errored when it was supposed to create it with
objFSO.CreateFolder(path);:
Quote
Microsoft JScript runtime error:
Path not found
Problem was solved by creating the media folder manually in shell:AppData\foobar2000\
I uncommented //gr.FillSolidRect(0, 0, ww, wh, g_backcolor); as well because the background was white and you couldn't see the text.


Re: R2YS a script for reddit

Reply #13
After the first shot where I had no problems to connect to reddit, I wanted to change my password (as I did not want to ues one of my 'good' passwords here). Old clident id with new pwd did not work, so I generated a new script and new client id and secret. However, since then I am not able to connect, not even with a fully new login at reddit (new email, new user,...). Any hints?

Re: R2YS a script for reddit

Reply #14
Try clearing the panel's properties and reload.
Right click the panel > Select Properties > Press the clear button > Apply.

Re: R2YS a script for reddit

Reply #15
Thanks very much!! Now works again perfect! (can't explain why I didn't even look into the properties.....)

 
SimplePortal 1.0.0 RC1 © 2008-2018