Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    jensen
    @jensechu_twitter
    a message
    jensen
    @jensechu_twitter
    Is there a way to see a user's account age via .getUser? Not seeing in the type definitions so I guess not but wanted to see
    Eric Gustavsson
    @SpyTec
    @jensechu_twitter not sure about the newline part. But for getUser you should be able to print out everything and find the account age variable that way, we don't have type definitions for everything as there's just so much of it and we haven't had time to add it
    Slupy
    @Slupy
    How can I find a post by words?
    Eric Gustavsson
    @SpyTec
    @Slupy You can most likely check for new posts to r/all/new
    Or the specific subreddits you're looking for. Such as r/aww+cats/new. Then for each post just check if they have the words you're looking for
    Htc Saj
    @htcsaj123_gitlab
    How to get links and titles for subreddit in last 5 or more days. I can get posts without link on that just for last day.Thanks in advance
    Eric Gustavsson
    @SpyTec
    @htcsaj123_gitlab you have a fetchMore functionality in snoowrap to get more posts. Once that errors out that's as far as you can go. You could utilize https://pushshift.io/ though as that makes it easier with searching for things
    But historical fetching is very difficult in Reddit. Their search can't solve the issue and the /new, /hot etc. listing only goes so far (1000 posts at maximum)
    Htc Saj
    @htcsaj123_gitlab
    r.getNew('subreddit').map(post => post.title).fetchMore().then(console.log);. I get error when I used this.
    Eric Gustavsson
    @SpyTec
    You're mapping the results and currying a function on the mapped results, hence the error. Move map to the end
    Htc Saj
    @htcsaj123_gitlab
    I fixed this thank you very very much
    Htc Saj
    @htcsaj123_gitlab
    One more questions.Is there a possibility to get link on posts.I only get post with titles but there isn't any links
    Eric Gustavsson
    @SpyTec
    Each post has a permalink property you can use. You can also use id and generate the url based on that, e.g. if id is n89a8v you can generate https://redd.it/n89a8v
    chosensty
    @chosensty
    quick and easy question, how do I get a random post from a specific subreddit?
    I've never used the reddit api before and all the tutorials I find are in python
    Eric Gustavsson
    @SpyTec
    chosensty
    @chosensty
    what is r representing?
    do I start my code with const r = require('snoowrap');
    nvm I found the answer in the docs
    chosensty
    @chosensty
    @SpyTec sorry for disturbing but I've searched everywhere and I can't find an answer, I am getting this error:
    Unhandled rejection StatusCodeError: 403
    my username password client id and client secret are all 100% correcct
    Cyanic
    @Cyanic
    Hello everyone, I'm using Snoowrap currently. I can authenticate and even post links to subreddit's including flair with no problem. What I'm trying to do no is simple post a comment on a post I created and have no idea how or where to look to do that. Any help would be appreciated. So for example I create a post that is a link to an image and then I want to post a comment with text. Any ideas how to do such a thing?
    Eric Gustavsson
    @SpyTec
    Cyanic
    @Cyanic
    Hey thanks for that. I actually figured it out in the end... but that link to the documents is very helpful. Been looking at the code thus far and it's been difficult.
    Cyanic
    @Cyanic
    const asyncFunc = async () => {
        try {
               const r = new snoowrap({
                userAgent: process.env.USERAGENT,
                clientId: process.env.CLIENTID,
                clientSecret: process.env.CLIENTSECRET,
                refreshToken: process.env.REFRESHTOKEN,
            });
    
            // Submitting a link to a subreddit
            r.getSubreddit('testingground4bots').submitLink({
                title: getDate() + 'testing',
                url: 'https://i.imgur.com/n5iOc72.gifv'}).then(function(response) {
                    console.log(response.permalink);
                    //const submission = r.getSubmission(response).reply('[this is a link](https://www.reddit.com' + response.permalink() + ') testing123');                
                });
        } 
        catch (err){        
            console.log(err);
        }
    }
    Console looks like this:
    [Function: targetFunc] {
      _promise_chain_cache: [Object: null prototype] {}
    }
    Cyanic
    @Cyanic
    any ideas why I response.permalink is null? The post does get created
    Cyanic
    @Cyanic
    Ok I think I see the error in my ways. I thought I was dealing with a comment when in fact it was a submission. There is no response.permalink for a submission only a reply. I think at least...
    Cyanic
    @Cyanic
    I noticed you can get a permalink for a reply is there nothing like that for submitlink?
    Eric Gustavsson
    @SpyTec
    @Cyanic there should be. You can always print out everything after having submitted, then you can see what is returned
    Cyanic
    @Cyanic
    @SpyTec I'm not sure I understand here is my code:
    const submitLinkRes = await r
                        .getSubreddit('foo')
                        .submitLink({
                            title: " some cool title",
                            url: link,
                            flair_id: fooFlair.flair_template_id});
    
                    console.log('response: ', submitLinkRes);                
    
                    const reply = await r.getSubmission(submitLinkRes).reply(comment);
                    console.log('reply: ', reply.permalink);
                    console.log('reply: ', reply);
    so the console log for reply is very long and obviously the reply.permalink gives the permalink to the reply. But I'm looking for the permalink of submitLinkRes and unfortunately the console log of submit LinkRes returns:
    Cyanic
    @Cyanic
    response: Submission { name: 't3_fso2ox' }
    and I don't see anything else

    I end up doing something like this to get the permalink of the submission

    myPermalink = (reply.subreddit_name_prefixed + "/" + submitLinkRes._uri).replace(/ /g,'');

    But obviously that's not as nice or as good as just getting the .permalink of the submission. I suppose I'm missing something obvious yes?

    Andrew213
    @Andrew213
    Hi everyone. pls help me, how can i banner of a post and post`s description (not title)
    how can i get*
    Cyanic
    @Cyanic
    Hello, anyone ever see this error: UnhandledPromiseRejectionWarning: StatusCodeError: 403 - "Blocked"
    I was running my code almost every day with no problem and now this.
    I thought maybe it was the subreddit I was posting to but I changed the subreddit and still the same error.
    Cyanic
    @Cyanic
    How long do the tokens last for?
    Cyanic
    @Cyanic
    hmmm today it magically works. I changed tokens yesterday and it failed. But today the old token and the new token works.
    Anyone have a clue what is going on?
    David Zorychta
    @Macmee
    has anyone here ever got fromApplicationOnlyAuth to work? It seems to fire two access_token requests, the first succeeds and the second fails..
    Ken Eucker
    @KenEucker
    I can't figure out how to get more than 250 results with r.getSubmission.search using fetchMore or fetchAll. Can someone help me understand how I can get all results from a search on a subreddit?
    Ken Eucker
    @KenEucker
    My first request returns 250 submissions, after that I don't know what to do from there. isFinished returns true, response.fetchMore({ amount: 100, after: [timestamp or t3_]}) only returns the same 250 submissions.
    Ken Eucker
    @KenEucker
    *correction r.getSubreddit.search