MrPowerScripts / reddit-karma-farming-bot

"Is karma really that important to you? Damn bro, you need a life" - YouTube Comment
https://mrpowerscripts.com
MIT License
297 stars 120 forks source link

Reposting is currently not working #203

Closed Luois45 closed 2 years ago

Luois45 commented 2 years ago

It can't get a post to repost currently. This is the message it displays:

18:29:48 running repost
18:29:48 finding a post to re-post
18:29:48 picking a random subreddit
18:29:49 checking subreddit: bangtan
18:29:49 searching post in sub: bangtan
18:29:49 couldn't find post in bangtan
18:29:49 repost attempts: 1
18:29:49 picking a random subreddit
18:29:49 checking subreddit: Cricket
18:29:49 searching post in sub: Cricket
18:29:49 couldn't find post in Cricket
18:29:49 repost attempts: 2
18:29:49 picking a random subreddit
18:29:49 checking subreddit: Survival
18:29:49 searching post in sub: Survival
18:29:49 couldn't find post in Survival
18:29:49 repost attempts: 3
18:29:49 picking a random subreddit
18:29:49 checking subreddit: tax
18:29:49 searching post in sub: tax
18:29:49 couldn't find post in tax
18:29:49 repost attempts: 4
18:29:49 couldn't find any posts - skipping reposting for now
Luois45 commented 2 years ago

@MrPowerScripts could you please have a look at this? 😉

Luois45 commented 2 years ago

I've backtested it with these requests: Not working: https://api.pushshift.io/reddit/search/submission/?subreddit=memes&score>=5000 Working: https://api.pushshift.io/reddit/search/submission/?subreddit=memes&score=>5000

MrPowerScripts commented 2 years ago

hmmmm when I open https://api.pushshift.io/reddit/search/submission/?subreddit=memes&score%3E=5000 in a browser I can see that it pulls down 25 submissions. I thought maybe it was the subreddits it was choosing. Like maybe it didn't have any posts with enough upvotes for that day. But this link works https://api.pushshift.io/reddit/search/submission/?subreddit=memes&score%3E=5000 as well. and it's one of the subredidits in your list that didn't find anything. But this is curious because nobody else has reported there's an issue with reposting. in fact, It seems people have been posting their results with the bot - as if it's working fine. so it's hard to say why it doesn't work for you. More logging that shows the result of the pushsshift API requests might help. But I think the PR you made changes the intent of the API request. Because the goal of the query is to get a list of highly upvoted posts with a specific minimum. So that we're only reposting things that were highly successful in the past. I think this change might bake it so the API returns more posts, but it would filter for posts with lower than the defined score. Is that correct?

Luois45 commented 2 years ago

Ok, it's strange that it's not working for me. I've closed the PR.

Luois45 commented 2 years ago

@MrPowerScripts Thanks for the answer/help 😊

Tharic99 commented 1 year ago

I'm seeing a few issues with reposting. It doesn't write to the logs when it fails though, but you can pull it from the running bash interface on Linux.

It does work some of the time though, but when it fails, it crashes out completely.

Pushshift.io link - https://api.pushshift.io/reddit/search/submission/?subreddit=EntitledBitch&before=1632942390&after=1632855990&score%3E=5000&limit=1&author!=[deleted]&selftext:not=[deleted]

15:06:29 02831340783 < 0.015 = True          
running action: reddit_post_chance
15:06:29 running repost
15:06:29 finding a post to re-post
15:06:29 picking a random subreddit
15:06:30 checking subreddit: EntitledBitch
15:06:30 searching post in sub: EntitledBitch
15:06:30 pushshift-url: https://api.pushshift.io/reddit/search/submission/?subreddit=EntitledBitch&before=1632942390&after=1632855990&score>=5000&limit=1&author!=[deleted]&selftext:not=[deleted]
Traceback (most recent call last):
  File "./src/init.py", line 12, in <module>
    bot.run()
  File "/home/user/bin/karmabot/src/bot.py", line 10, in run
    reddit.run()
  File "/home/user/bin/karmabot/src/bots/reddit/bot.py", line 65, in run
    self.tick()
  File "/home/user/bin/karmabot/src/bots/reddit/bot.py", line 60, in tick
    action.call()
  File "/home/user/bin/karmabot/src/bots/reddit/actions/post_actions.py", line 99, in repost
    api_call=requests.get(post.url).status_code
  File "/home/user/bin/karmabot/.venv/lib/python3.6/site-packages/requests/api.py", line 75, in get
    return request('get', url, params=params, **kwargs)
  File "/home/user/bin/karmabot/.venv/lib/python3.6/site-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home/user/bin/karmabot/.venv/lib/python3.6/site-packages/requests/sessions.py", line 515, in request
    prep = self.prepare_request(req)
  File "/home/user/bin/karmabot/.venv/lib/python3.6/site-packages/requests/sessions.py", line 453, in prepare_request
    hooks=merge_hooks(request.hooks, self.hooks),
  File "/home/user/bin/karmabot/.venv/lib/python3.6/site-packages/requests/models.py", line 318, in prepare
    self.prepare_url(url, params)
  File "/home/user/bin/karmabot/.venv/lib/python3.6/site-packages/requests/models.py", line 392, in prepare_url
    raise MissingSchema(error)
requests.exceptions.MissingSchema: Invalid URL '': No scheme supplied. Perhaps you meant http://?
user@ubuntu:~/bin/karmabot$ 

Here's another snippet of the logs, showing successful repost and comment post and then another failure...

15:15:31 replying to comment
15:15:35 85226196287 < 0.01 = True         
running action: reddit_comment_chance
15:15:35 going to make a comment
15:15:35 picking a random subreddit
15:15:35 checking subreddit: deloitte
15:15:37 replying to comment
15:16:20 98013430102 < 0.015 = True          
running action: reddit_post_chance
15:16:20 running repost
15:16:20 finding a post to re-post
15:16:20 picking a random subreddit
15:16:20 checking subreddit: warmane
15:16:20 searching post in sub: warmane
15:16:20 pushshift-url: https://api.pushshift.io/reddit/search/submission/?subreddit=warmane&before=1632942980&after=1632856580&score>=5000&limit=1&author!=[deleted]&selftext:not=[deleted]
15:16:21 reposting post: pxqven
15:16:30 958780071405 < 0.01 = True          
running action: reddit_comment_chance
15:16:30 going to make a comment
15:16:30 picking a random subreddit
15:16:30 checking subreddit: ebikes
15:16:32 replying to comment
15:17:16 533140049264 < 0.015 = True         
running action: reddit_post_chance
15:17:16 running repost
15:17:16 finding a post to re-post
15:17:16 picking a random subreddit
15:17:16 checking subreddit: Celebs
15:17:16 searching post in sub: Celebs
15:17:16 pushshift-url: https://api.pushshift.io/reddit/search/submission/?subreddit=Celebs&before=1632943036&after=1632856636&score>=5000&limit=1&author!=[deleted]&selftext:not=[deleted]
15:17:17 reposting post: pxdrhr
15:17:25 084836768048 < 0.002 = True         
running action: reddit_remove_low_scores
15:17:25 checking for low score content to remove
15:17:26 no low score content to clean up. I'm a good bot! :^)
15:19:38 158913282788 < 0.002 = True          
running action: reddit_shadowban_check
15:19:38 performing a shadowban check
15:19:44 137036410583 < 0.015 = True          
running action: reddit_post_chance
15:19:44 running repost
15:19:44 finding a post to re-post
15:19:44 picking a random subreddit
15:19:44 checking subreddit: pyrocynical
15:19:44 searching post in sub: pyrocynical
15:19:44 pushshift-url: https://api.pushshift.io/reddit/search/submission/?subreddit=pyrocynical&before=1632943184&after=1632856784&score>=5000&limit=1&author!=[deleted]&selftext:not=[deleted]
Traceback (most recent call last):
  File "./src/init.py", line 12, in <module>
    bot.run()
  File "/home/user/bin/karmabot/src/bot.py", line 10, in run
    reddit.run()
  File "/home/user/bin/karmabot/src/bots/reddit/bot.py", line 65, in run
    self.tick()
  File "/home/user/bin/karmabot/src/bots/reddit/bot.py", line 60, in tick
    action.call()
  File "/home/user/bin/karmabot/src/bots/reddit/actions/post_actions.py", line 99, in repost
    api_call=requests.get(post.url).status_code
  File "/home/user/bin/karmabot/.venv/lib/python3.6/site-packages/requests/api.py", line 75, in get
    return request('get', url, params=params, **kwargs)
  File "/home/user/bin/karmabot/.venv/lib/python3.6/site-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home/user/bin/karmabot/.venv/lib/python3.6/site-packages/requests/sessions.py", line 515, in request
    prep = self.prepare_request(req)
  File "/home/user/bin/karmabot/.venv/lib/python3.6/site-packages/requests/sessions.py", line 453, in prepare_request
    hooks=merge_hooks(request.hooks, self.hooks),
  File "/home/user/bin/karmabot/.venv/lib/python3.6/site-packages/requests/models.py", line 318, in prepare
    self.prepare_url(url, params)
  File "/home/user/bin/karmabot/.venv/lib/python3.6/site-packages/requests/models.py", line 392, in prepare_url
    raise MissingSchema(error)
requests.exceptions.MissingSchema: Invalid URL '': No scheme supplied. Perhaps you meant http://?
user@ubuntu:~/bin/karmabot$