Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

potential bugs and questions #2017

Closed
1 task done
jiangchao9987 opened this issue Mar 23, 2024 · 2 comments
Closed
1 task done

potential bugs and questions #2017

jiangchao9987 opened this issue Mar 23, 2024 · 2 comments
Labels
Stale Issue or pull request has been inactive for 20 days

Comments

@jiangchao9987
Copy link

Describe the Bug

1)url dismatch
2) replace_more (limit=None) makes the len(comments) bigger than original
3) could you make clear about what is difference between limit = 0 and None in replace_more

Desired Result

  1. question 1
    when inputing submission = reddit.submission(url = "https://www.reddit.com/r/funny/comments/3g1jfi/buttons/")
    and expecting the output of print(submission.url)

is the outcome is http://41.media.tumblr.com/a353323397c0aa0b4cfbc21eead3d48f/tumblr_ns7d7t7F6H1rvcmlco1_1280.jpg

  1. question 2

the len() of toplevel of reddit.submission.comments are different when replace_more is 0 , None or no replace_more
the len(reddit.submission.comments ) is 198 when replace_more (limit=0)
the len(reddit.submission.comments ) is 218 when replace_more (limit=None)
the len(reddit.submission.comments ) is 199 when no replace_more

Code to reproduce the bug

import praw

reddit = praw.Reddit(
    "bot1"
)

submission = reddit.submission(url="https://www.reddit.com/r/funny/comments/3g1jfi/buttons/")
print(submission.url)
submission.comments.replace_more(limit=None)
print(len(submission.comments))

submission = reddit.submission(url="https://www.reddit.com/r/funny/comments/3g1jfi/buttons/")
submission.comments.replace_more(limit=0)
print(len(submission.comments))

submission = reddit.submission(url="https://www.reddit.com/r/funny/comments/3g1jfi/buttons/")
print(len(submission.comments))

My code does not include sensitive credentials

  • Yes, I have removed sensitive credentials from my code.

Relevant Logs

http://41.media.tumblr.com/a353323397c0aa0b4cfbc21eead3d48f/tumblr_ns7d7t7F6H1rvcmlco1_1280.jpg
218
198
199

This code has previously worked as intended

Yes

Operating System/Environment

Windows

Python Version

3.10.13

PRAW Version

7.7.2.

Links, references, and/or additional comments?

No response

@LilSpazJoekp
Copy link
Member

LilSpazJoekp commented Mar 23, 2024

  1. Historically, Reddit is a place to post links. The url attribute refers to the url that is posted to Reddit not the url of the post on Reddit. That would be post.shortlink or post.permalink.
  2. limit=None means there is not a limit to how many MoreComments PRAW will replace. limit=0 means no MoreComments get replaced. This is explained in the docs.

Copy link

This issue is stale because it has been open for 30 days with no activity.

Remove the Stale label or comment or this will be closed in 30 days.

@github-actions github-actions bot added the Stale Issue or pull request has been inactive for 20 days label Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Stale Issue or pull request has been inactive for 20 days
Projects
None yet
Development

No branches or pull requests

2 participants