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

Next page #83

Open
ghost opened this issue Jul 5, 2018 · 0 comments
Open

Next page #83

ghost opened this issue Jul 5, 2018 · 0 comments

Comments

@ghost
Copy link

ghost commented Jul 5, 2018

hey, I saw your post on the repos reddit page. I tired the example code you commented but I got some weird error that the second page variable is not found. I checked the repo to see if you created a function to get more pages, I did not see one. Its pretty late right now and im tired so I prob missed it or its a dumb fix.

My code is:

    num = rand(1...100)
    r_all = reddit.subreddit("snapfuck")
    post = r_all.top(time: :all, after: second_page.after)
    post_url = post.url
    check_url = post_url.split(".").last
    puts check_url, post_url

My code before I attempted to edit it was, there was a big list of certain subreddits and it would pick one by random and then scrape a random image from that page.

subredit =  [ 'sample7', 'sample6', 'sample5', 'sample4', 'sample3', 'sample2', 'sample1'].sample
num = rand(1...100)
r_all = reddit.subreddit(subreddits)
post = r_all.hot[num]
post = r_all.top(time: :all, after: second_page.after)
post_url = post.url
check_url = post_url.split(".").last
puts check_url, post_url

its prob an easy fix, but i cant figure it out. prob been working on it to long and got tunnel vision.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants