OC GitHub - v1nsai/red2lem: Crossposts from Reddit to Lemmy

I've been working on a bot to automate crossposting from a given subreddit to a given Lemmy community. It's pretty basic and not very well tested but it's working if anyone wants to try it out.

For now it relies on the Reddit API because it has a handy streaming object and I didn't know you could just go to a subs homepage and append ".json" to the URL

Features right now:

  • Watches a sub and posts to Lemmy as new posts come in
  • Pulls images and videos from third party hosts and includes them in posts
  • Copies titles and selftexts

With this we can close the "content gap" between Reddit and Lemmy, similar to everyone posting Digg content to Reddit as Digg died due to checks notes corporate mismanagement at efforts to monetize. Huh.

Comment, fork, star, open issues and enjoy.

lixus98, (edited )
lixus98 avatar

I also made a similar bot, might be useful!, this one doesn't check every single post, only external links, I didn't want to repost original content or spam communities, so the post only gets one post per hour (which can be changed) and checks the community to see if there's a similar post there already (same link).

Edit: it uses the json page, and filters posts based on upvotes, downvotes, age, etc. It supports multiple subreddits and communities at the same time.

https://github.com/daniel-lxs/BotIt

Mnmalst,
Mnmalst avatar

Ah sweet I was about to start working on something like this. Will definitely use it in the future. Thanks
*edit: Ah it still uses the public json endpoints. A "real" scrapper might be necessary in the future.

lixus98,
lixus98 avatar

You are right, I already had a scraper in progress, if it comes down to it I will use that instead.
Edit: also you can contribute if you want to, suggestions are 100% open.

Mnmalst,
Mnmalst avatar

I might if I find something I am missing.
I have some specific requirements when it comes to scrapping. I am planning to use it on my phone in termux which doesn't allow all nodejs modules. Sadly also the most popular scrappers which use a xserver in the background. So it has to be very basic html scrapping which should be possible when you do it on the old.reedit site.

lixus98,
lixus98 avatar

I see, I used node bc that's what I'm most familiarized with. I'm running it from Digitalocean and seems to be stable for now.
But if you have different requirements you should definitely give making one a go.

Mnmalst,
Mnmalst avatar

Oh, nothing wrong with node at all. I used it for something very similar in the past myself. It's just that certain modules just don't work in termux.

chuso,
chuso avatar

I know crossposters make transition easier for people who find it hard to completely switch from Reddit to Lemmy, but we've been there already in Mastodon and crossposters were not very appreciated because they are basically bots. They allow you to continue using Reddit or Twitter as your main account while you mirror your content to Lemmy or Mastodon.
It's frustrating for people who actually use Lemmy or Mastodon to find some content they want to interact with and later notice it's from an unattended account that is just mirroring content from another site so your interactions won't get any reply because you are basically talking to a bot.

abraham_linksys,

Not sure how this would contribute to people still using Reddit/Twitter as their main feed? This is for mirroring subreddits so the content can be browsed from Lemmy and when you comment, your comment is viewed by others using Lemmy. I think this is good mainly for videos, images and links and discussing them here on Lemmy. Wouldn't make sense for subs where you want to interact directly with OP, like advice subs.

Thanks for the feedback though, a bot flag in the title would eliminate anyone mistaking a bot for a person.

Zamboniman,
@Zamboniman@lemmy.ca avatar

Wasn’t able to get it working. Some error about ’ attempted relative import with no known parent package’. I know nothing about python. See Github issue I created for more details.

Zamboniman,
@Zamboniman@lemmy.ca avatar

How do we set it up for multiple subreddits/communities rather than just the one in vars.py?

BedSharkPal,

Looks like it posts images without domain checking? I assume that would result in a bunch of Reddit hosted images being posted here?

Tarte,
Tarte avatar

Awesome!

I don't know how to set any of this up. But if anyone manages to get /r/AskHistorians crossposted here, that'd be awesome. I believe that's a prime target for crossposts, because for most people it's read-only anyway and not discussion.

r3dcomet,

this would be so much easier for people to transition ! thank you

r7vil50j,
r7vil50j avatar

Thanks for your contribution!

mianghuei,

Was there some script or program that scrapes a subreddit and export/converts it into Lemmy/Fediverse database?

greensky,
NotAPenguin,

There's https://lemmit.online/ which mirrors subreddits, you can request ones you want mirrored.

However I can't seem to access it from kbin at all.

Jaysyn,
Jaysyn avatar

Wlll this work for kBin as well?

lixus98,
lixus98 avatar

It should, since it's all federated a lemmy account can post on kbin

Jaysyn,
Jaysyn avatar

Thanks for the info.

greensky,

Can we do that for comments?

abraham_linksys,

It's possible but kind of pointless. Who wants to read a bunch of comments of people being wrong and not even be able to respond (directly) to them?

Tarte,
Tarte avatar

Already posted above: I believe /r/AskHistorians would be a prime use case.

greensky,

Comments are often more valuable than posts. Keeping an archive of posts and comments on Lemmy can be valuable.

Dick_Justice,
@Dick_Justice@lemmy.world avatar

Nice! You may be interested in talking to the admin working on https://lemmit.online who is doing much the same thing with success. Maybe y'all could collab or share notes or something. Details on what he's doing are here: https://lemmy.world/comment/325260

tikitaki,
tikitaki avatar

since reddit API is gonna die in 9 days, are there any plans to do anything else?

abraham_linksys,

API is changing in a few days, not being dropped. I haven't dug into it but I'm not too worried that usage will go above free tier. If that dies there's the .json versions of the site you can view by adding .json to most reddit URLs, and even if they kill that there will always be scraping.

Zamboniman,
@Zamboniman@lemmy.ca avatar

I think I'll take a look and give this a try, thanks.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • RedditMigration
  • PowerRangers
  • DreamBathrooms
  • thenastyranch
  • magazineikmin
  • everett
  • Youngstown
  • tacticalgear
  • slotface
  • ngwrru68w68
  • rosin
  • khanakhh
  • kavyap
  • tsrsr
  • InstantRegret
  • normalnudes
  • mdbf
  • Durango
  • GTA5RPClips
  • cubers
  • vwfavf
  • ethstaker
  • hgfsjryuu7
  • osvaldo12
  • tester
  • cisconetworking
  • modclub
  • Leos
  • anitta
  • All magazines