GithubHelp home page GithubHelp logo

Comments (8)

tobywhughes avatar tobywhughes commented on May 28, 2024

I'm guessing this is an issue with PRAW. Though, looking at the docs, I still feel like this should work. While searching, I did find this

get_multireddit(multi, *args, **kwargs)

    Return a multireddit that belongs to this user.
    Parameters: multi – The name of the multireddit
    Returns:    Multireddit object with author=Redditor and name=multi

However, that looks like it depends on the users personal multi, not creating it with the actual address.

from rtv.

ddworken avatar ddworken commented on May 28, 2024

This doesn't seem to be an issue with PRAW. This can be verified by open a python console and running the following:

In [1]: import praw

In [2]: r = praw.Reddit(user_agent='my_cool_application')

In [3]: submissions = r.get_subreddit('opensource+linux').get_hot(limit=5)

In [4]: [str(x) for x in submissions]
Out[4]:
['573 :: Dell launches Ubuntu loaded machines across 500 stores in Latin America',
 '8 :: Proprietary Scumminess: The Case of Dropbox',
 '14 :: Enormous Changes to Google Summer of Code in 2015. Over 130 projects ou...',
 '18 :: Open-Source Solutions As A Business Model',
 '37 :: PuTTY 0.64 is released']

(Notice that you get results from both /r/opensource and /r/linux. This seems to be some problem with the from_name function in the SubredditContent class (defined in rtv/content.py).

from rtv.

ddworken avatar ddworken commented on May 28, 2024

After further investigation, it would appear that this might in fact be a bug with PRAW. It seems that that problem ultimately comes down to the line:

sub = reddit.get_subreddit('linux+opensource', fetch=True) 

This returns a 404 error, while setting fetch to False does not return a 404 error. So this can be fixed by bringing that line of code back in line with the rest of code base (which uses lazy objects). This issue is fixed by #16

from rtv.

michael-lazar avatar michael-lazar commented on May 28, 2024

Thanks for investigating this, I'll check it out tonight. I put the fetch=True flag to verify that the subreddit actually existed. If you look in from_name(), there's a workaround for /r/all for the same reason. Have you tested your fix out with gibberish or invalid names? I remember having problems with those at the time.

from rtv.

ddworken avatar ddworken commented on May 28, 2024

Good point, it looks like this fails silently on gibberish names (due to the lazy loading not actually loading it). Due to that, I would say there are two options:

  1. Wait until the bug is fixed in PRAW (which I might take a look at a bit later tonight)
  2. Simply force PRAW to load it immediately afterwards by acting on the subreddit object before breaking out of the try except block (which works around the PRAW bug).

from rtv.

michael-lazar avatar michael-lazar commented on May 28, 2024

I don't mind option 2. We just have to make sure not to lose any data in the process of checking the generator. Maybe something like

content = cls('/r/'+sub.display_name, sub.get_hot(limit=None), loader)
content.get(0)  # Validate that content exists before initializing
return content

from rtv.

ddworken avatar ddworken commented on May 28, 2024

Yeah that makes sense to me.
On Mar 3, 2015 8:10 PM, "michael-lazar" [email protected] wrote:

I don't mind option 2. We just have to make sure not to lose any data in
the process of checking the generator. Maybe something like

content = cls('/r/'+sub.display_name, sub.get_hot(limit=None), loader)
content.get(0) # Validate that content exists before initializing
return content

β€”
Reply to this email directly or view it on GitHub
#15 (comment).

from rtv.

michael-lazar avatar michael-lazar commented on May 28, 2024

Implemented ala option 2. b992645

from rtv.

Related Issues (20)

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.