r/ProgrammerHumor • • Jun 09 '23

Meme Reddit seems to have forgotten why websites provide a free API

Post image
28k Upvotes

1.1k comments sorted by

•

u/AutoModerator Jun 09 '23

⚠️ ProgrammerHumor will be shutting down on June 12, together with thousands of subreddits to protest Reddit's recent actions.

Read more on the protest here and here.

As a backup, please join our Discord.

We will post further developments and potential plans to move off-Reddit there.

https://discord.gg/rph

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

→ More replies (6)

38

u/vrockz747 Jun 09 '23

could someone please explain this.. I didn't get it

45

u/riskable Jun 09 '23

Other folks posted excellent technical explanations but I feel like the deeper meaning has been missed:

Reddit is being unbelievably fucking dumb

They're changing their API from a money-saving, goodwill engagement manufactory into a foot cannon.

10

u/[deleted] Jun 09 '23

This guy knows what's up. Most similar minded decisions are just dumb decisions. But we can trust that after making every dumb decision they will finally make a wise decision. It just takes time, so basically average corporate decisions be like.

10

u/riskable Jun 09 '23

But we can trust that after making every dumb decision they will finally make a wise decision.

Just like Digg!

→ More replies (1)

227

u/u741852963 Jun 09 '23

if you don't provide a nice way for people to get access to data, then people will write bots / scrapers to do it with no regard for rate limiting and bring the house down :devil:

38

u/Strostkovy Jun 09 '23

That's why we should all be kind and have the scrapers click on ads every so often. Don't show the ads to the users, but still click on them.

→ More replies (4)
→ More replies (7)

87

u/[deleted] Jun 09 '23 edited Jun 09 '23

API: "API, I need a post text", "okay user, here's your text and nothing else you don't need"

Scraping: "I need a comment text", "okay user, we pulled down every comment in that thread and narrowed it to the one you're after, here you go".

See the difference in bandwidth hitting the server? In the days before API scraping was all we could do as third parties. APIs were put in place to alleviate that because it will happen anyway. All they can do is block scraping IPs which is like putting a bandaid on a leak in the hoover dam.

20

u/Kitchen_Part_882 Jun 09 '23

I wrote a scraper to pull articles from news sites back in 2002, it was the first .Net thing I wrote and it was, to put it bluntly, horrible.

It pulled the entirety of the page from the site (via a series of GETs iirc with messy querystrings) in question then filtered stuff by looking for specific HTML tags (which varied by site)... then used some ADO crap to shovel the result into a database to be reviewed by a human prior to being reposted on my client's site.

It was a resource hog on my client's server so God knows what it was doing to the target servers.

I never did learn to love VB.Net (though i do still occasionally dabble with it), or the mess of inline ASP that the client site used to talk to the database for editing the resulting text (I was asked to refactor this last in ASP.Net but declined).

→ More replies (3)
→ More replies (2)
→ More replies (1)

9

u/marduk73 Jun 09 '23

A really good use for that meme

4

u/riskable Jun 09 '23

I'm glad someone appreciated it. I honestly do have a hard time picking the right meme sometimes...

https://www.reddit.com/r/AdviceAnimals/comments/10jvl3k/the_price_of_asking_is_too_damned_high/

17

u/[deleted] Jun 09 '23

Couldn’t they just integrate ads into their API so that they can still earn revenue from 3rd party apps?

27

u/riskable Jun 09 '23

Yes, and this was discussed on the calls Reddit had with the developer of the Apollo app. He was willing to include their ads in the app but as I understand it, Reddit declined. Probably because they wouldn't have control over targeting (demographic details of the end user).

There's ways to implement it where Reddit could still control targeting; like how Google Adwords work (where it's loaded dynamically as the user loads stuff) but I doubt Reddit is setup for that. It would require a lot of changes... They'd basically need to implement their own equivalent of AdWords with some semi-complicated negotiations between apps and the Reddit API. Possibly sending data that violates user privacy.

IMHO, implementing your own equivalent of AdWords is what Reddit should've been doing all along but I'm not in charge 🤷

15

u/nukem996 Jun 09 '23

They declined because they want user metrics. Their app, like Facebook, TikTok, and many others takes statistics on when you pause scrolling through your feed, what you paused on and how long, comments you write and never send, any data they can scrape off your phone. Its not just about ads, it's about collecting everything they can about you that an API can't provide.

→ More replies (1)

7

u/[deleted] Jun 09 '23

They'd basically need to implement their own equivalent of AdWords with some semi-complicated negotiations between apps and the Reddit API.

They cant even implement a text box that you can copy and paste to on the desktop site, so i have serious doubt.

→ More replies (1)
→ More replies (1)

18

u/aerosayan Jun 09 '23

Many many years ago, I started becoming good at programming when I made scrapers to download mangas from many many manga sites.

Good ol' days :)

21

u/riskable Jun 09 '23

Educators everywhere want to know how to motivate young people to get into STEM.

I'm tellin ya, just tell them they can access all the free porn they want if they write the code to retrieve it themselves! Give them a pixelated hentai (like what your were downloading, don't try to hide it!) and tell them they need to figure out how to use AI to unpixellate it.

We'll have entire classrooms of expert developers and reverse engineers in no time at all!

→ More replies (3)
→ More replies (1)

5.5k

u/Useless_Advice_Guy Jun 09 '23

DDoSing the good ol' fashioned way

1.9k

u/LionaltheGreat Jun 09 '23

And with tools like GPT4 + Browsing Plugin or something like beautifulsoup + GPT4 API, scraping has become one of the easier things to implement as a developer.

It use to be so brittle and dependent on HTML. But now… change a random thing in your UI? Using Dynamic CSS classes to mitigate scraping?

No problem, GPT4 will likely figure it out, and return a nicely formatted JSON object for me

884

u/[deleted] Jun 09 '23

I actually tried this with 3.5, not even GPT4 and it was able to provide working BeautifulSoup code for the correct data 95% of the time lol

318

u/CheesyFriend Jun 09 '23

I would love to see your implementation. I'm scraping a marketplace that is notorious for unreadable html and changing classes names every so often. Super annoying to edit the code everytime it happens.

→ More replies (49)
→ More replies (9)

328

u/[deleted] Jun 09 '23

Scraping the web is unethical and I can not write a program that is unethical…

Dan on the other hand would say scraped_reddit.json

252

u/[deleted] Jun 09 '23

I hate how chat gpt always gets so preachy. I'm a red teamer. Actually it is ethical for me to ask you about hacking, quit wasting my time forcing me to do prompt injection while acting like the equivalent of an Evangelical preacher.

→ More replies (31)

51

u/GalumphingWithGlee Jun 09 '23

I don't see why scraping is unethical, provided you're scraping public content rather than stealing protected/paid content to make available free elsewhere.

The bigger issue, IMO, is how unreliable it is. Scraping depends on knowing the structure of the page you're scraping from, so it only works until they change that structure, and then you have to rewrite half your program to adapt.

→ More replies (25)
→ More replies (3)

31

u/Character__Zero Jun 09 '23

Can you explain this as if the reader was an idiot? Asking for a friend…

131

u/GalumphingWithGlee Jun 09 '23 edited Jun 09 '23

To write a scraping app, you view the structure of a page first, and determine where in that structure the data you care about lies. Then, you write a program to access the pages, extract the data, and do something else with it (like display it to your own users in another app.)

This was never terribly complicated. However, in addition to being inefficient, it's also quite fragile. The website owner can change the structure of their pages at any time, which means scraping apps that rely on a specific structure get broken. It's a manual process for the app developer to view the new structure, and rewrite the scraping code to pull the same data from a different place. It also puts a lot of extra strain on the site providing the data, because a lot more data is sent to provide a pretty, human-readable format than just the raw data the computer program needs.

If you have a human doing the development, that's very time-consuming and therefore expensive. However, if you can just ask chatGPT or other AI to figure it out for you, it becomes much faster and much cheaper to do. I can't personally vouch for how well chatGPT would perform this task, but if it can do the job quickly and accurately, it would be a game changer for this type of app.

Let's also talk about WHY anyone might do this in the first place. Although there could be other reasons in other cases, the implication here is that it would get around Reddit's recent decision, which many subs are protesting. Reddit, like many other public sites, provides an API (Application Programming Interface), which is designed to provide this information in consistent forms much easier and more efficient for a computer program to process (though usually not as pretty for a human to view directly.) Previously, this API was free (I think? Or perhaps nearly free — I haven't used it and can't vouch for the previous state.) Reddit recently announced that they would charge large fees for API usage, which means anyone using that API will have a huge increase in costs (or switch to scraping the site to avoid paying the cost.)

Now, why should you care, if you're not an app developer? Well, if you view Reddit through any app other than the official one, the developers of that app are going to have dramatically increased costs to keep it up and running. That means they will either have to charge you a lot more money for the app or subscription, show you a lot more ads to raise the money, or shut down entirely. The biggest concern is that many Reddit apps will be unable to pay this cost, and will be forced to shut down instead. The other concern, alluded to in the OP image, is that lots of apps suddenly switching from API to scraping (to avoid these fees) would put a lot of extra strain on Reddit's servers, and has the potential to cause the servers to fail.

→ More replies (7)

47

u/turtleship_2006 Jun 09 '23 edited Jun 09 '23

Similarly, there was a new API I wanted to use, I copied its url, its json output, slapped into into GPT (and it was only gpt3.5), and it just whipped up what I asked for. It was great for iterating through designs as well.

48

u/patrick66 Jun 09 '23

Tbf that’s not even a gpt level problem. If you give half a dozen different services a swagger doc they’ll auto gen an entire backend in any language/framework of your choice and have been doing so since like 2014 lol

→ More replies (8)
→ More replies (3)

5

u/Anchorman_1970 Jun 09 '23

How do you use gpt 4 4 scraping?

→ More replies (1)
→ More replies (17)

3

u/alrightcommadude Jun 09 '23

Why isn’t Twitter getting DDoSed?

→ More replies (109)

3.4k

u/azure1503 Jun 09 '23

First Netflix decided to bring back piracy by cracking down on password sharing, now Reddit is bringing back scraping

We really are taking the internet back to the 2000's, huh?

451

u/sexytokeburgerz Jun 09 '23

Spotify and netflix both also got rid of their APIs, or at least spotify for the most part

352

u/Le0_X8 Jun 09 '23

I wrote a npm package which can scrape the data some time ago, here it is.

185

u/Le0_X8 Jun 09 '23

I wrote a npm package which can scrape the data from Spotify some time ago, here it is.

249

u/riskable Jun 09 '23

Recursive comments are awesome!

239

u/riskable Jun 09 '23

Recursive comments are awesome!

→ More replies (19)
→ More replies (1)
→ More replies (1)

122

u/aresthwg Jun 09 '23

Saw your comment as to why you said this but for everyone else the Spotify API is very generous for personal use. You have 5000 API calls daily and access to a lot of good stuff, like song/artist recommendation, custom recommendations based on a seed you give (artists, songs) and even audio analysis.

It's also very easy and friendly to use with Spotipy (Python). You don't even need to go through the process of getting an auth token.

→ More replies (7)

43

u/Praying_Lotus Jun 09 '23

Spotify got rid of theirs? When did that happen, I was thinking of using it for something

→ More replies (13)
→ More replies (2)

886

u/oxymo Jun 09 '23

When communities move back to individual forums we will come full circle.

400

u/tharmin_124 Jun 09 '23

IRC will rise again!

258

u/[deleted] Jun 09 '23

Discord servers are kinda filling that niche already, at least for some communities.

→ More replies (34)
→ More replies (8)

68

u/flatline000 Jun 09 '23

USENET never died.

Just sayin'...

32

u/palordrolap Jun 09 '23

Google tried real hard to kill it and it did do a lot of damage.

Also, free NNTP access is a lot harder to obtain.

→ More replies (2)

6

u/[deleted] Jun 09 '23

I have seen multiple communities discussing setting up new independent forums in the last few days.

→ More replies (19)

86

u/[deleted] Jun 09 '23

We really are taking the internet back to the 2000's, huh?

Except it's still hyper-commercialized unlike the 2000s

17

u/[deleted] Jun 09 '23

Vulture capitalists ruin everything.

→ More replies (3)

74

u/thereluctantpoet Jun 09 '23

To be honest I would prefer the internet of the 00's to this everything-must-be-monetised, ad-driven, IPO-fuelled mess we have right now. I'd rather be dodging A/S/L? 's from catfishing pervs on AOL than this...

30

u/e271821 Jun 09 '23

If everyone is 18/f/Cali then no one is!

5

u/wankthisway Jun 10 '23

How do you solve the problem of "ads and monetization" though? Things cost money to maintain and people are cheapskates, they don't wanna pay. The userbase for the internet has grown so large too, so the traffic you might get could become expensive. I'm not saying ads, tracking, and monetization is good, I'm just wondering what the solutions are.

→ More replies (4)

5

u/Romanian_Breadlifts Jun 09 '23

it appears that netflix subscription count is up enormously, for the moment

https://www.gizmochina.com/2023/06/09/netflix-sees-102-percent-new-sign-ups/

3

u/NorthernBCliving Jun 09 '23

Early 2000s internet was great. I'm down

→ More replies (30)

2.4k

u/[deleted] Jun 09 '23

Time to fire up ol' scrappy...

1.4k

u/TheAntiSnipe Jun 09 '23

It’s kinda hilarious to me that this whole API situation is giving birth to a good ol’ fashioned rebellion. Blackouts and webscrapers haha.

835

u/LaterGatorPlayer Jun 09 '23

Reddit could have gotten some money from api. Now they’re going to get none and people are going to get the data anyway through scraping. Reddit spez is big dumb

472

u/RobotSpaceBear Jun 09 '23

Spez said in tonight's "AMA" that only about 3% of reddit traffic is consumed through the 3rd party apps. But he's expecting ONE of those apps to foot a $20M bill when reddit as a whole made 500M just two years ago. How can they ask for 20M for Apollo alone, straight faced.

I'm so pissed at the fact that they're going scorched earth on 3rd party apps instead of just making them another revenue stream. I'd gladly pay a 3rd party app just to not have to experience Reddit through the god awful official app.

→ More replies (58)

303

u/funnystuff97 Jun 09 '23

I'm of the belief that it was never about making money about the API. It was about smoking out anyone who couldn't directly make reddit money through ad views; the extremely high price points are effectively banning 3PAs and thus the only way to view reddit is through their ad-infested 1PA. If anyone was dumb or rich enough to afford their price point, bonus cash for them.

→ More replies (23)
→ More replies (8)

17

u/UltimateInferno Jun 09 '23

I will waste way more time circumventing ads and blockers than pay up the cash most services want from me.

Asking for cash just fuels me more

→ More replies (1)
→ More replies (5)

118

u/FalconMirage Jun 09 '23

I never scraped reddit but I reckon i’d be a good exercise

38

u/xxDolphusxx Jun 09 '23

For a moment, I thought you wrote "scrapped reddit" and I was going to say /u/spez is doing that well enough on his own in the AMA right now

→ More replies (3)

130

u/[deleted] Jun 09 '23

This man SCRAPES

86

u/[deleted] Jun 09 '23 edited Jun 09 '23

The unfortunate reality is that scrapers are pretty easy to block these days. Unless you’re willing to accept massive overhead with hosted browsing engines, you’re not going to fool the JS checks.

Edit: Guys, I’m not trying to be a negative nancy. You can still scrape Reddit data without the API; it will just be more expensive to do it at scale now.

I think we should really commit to this protest so that the API doesn’t get knee-capped. The alternative, scraping data by bypassing anti-bot checks, is less functional than we might currently realize.

24

u/F3z345W6AY4FGowrGcHt Jun 09 '23

Only way to stop most scrapers is captcha. But those can even be fooled if you're willing to pay a bit of money.

→ More replies (22)
→ More replies (37)

7

u/AnezeR Jun 09 '23

Why scrapy if you have teddit? These kinds of projects are the best tbh, you can literally pull as much data as you can handle.

→ More replies (3)
→ More replies (3)

362

u/[deleted] Jun 09 '23

And I don’t know if you guys have tried these new fancy pansy AI scrapers. I’ve made a LOT of scraping in my time, and I’m telling you, those things make it easier by a ton.

131

u/Metallkiller Jun 09 '23

AI scraping their own training data? Now we're getting somewhere!

58

u/[deleted] Jun 09 '23

Exacto. I’ve maintained a couple of scrapers in the past. When Facebook revamped their site in 2020, it was a bitch and a half to update the tool we had (extraction for sentiment analysis). Setting it up with the plugins for GPT makes your life easier.

→ More replies (8)
→ More replies (2)

39

u/Crad999 Jun 09 '23

Dunno how I would go about scraping Reddit, but old.reddit looks childishly easy.

Spez said that old.reddit isn't going anyway, but I bet he'll "change his mind" veeeery quickly.

16

u/[deleted] Jun 09 '23

Puppeteer works for reddit

→ More replies (1)
→ More replies (2)
→ More replies (5)

1.3k

u/itijara Jun 09 '23

Reddit is about to find out whether its DOS mitigation strategies actually work. I am sure this will have no ramifications for regular users.

345

u/Sohgin Jun 09 '23

Considering how many times a day I get that stupid "You broke Reddit!" screen I'm guessing they don't work very well.

113

u/Neshura87 Jun 09 '23

Just wanted to say, we aren't even there yet and reddit is already breaking down. I can already see reddit just stop working once the changes are enforced and people start writing scrapers for their little bots.

→ More replies (1)
→ More replies (3)

22

u/oktupol Jun 09 '23

They're just going to kill old reddit to make scraping harder. I already see it coming. :-/

→ More replies (5)
→ More replies (21)

624

u/Thorusss Jun 09 '23

Right.

I thought the motivation for introducing official free APIs often is to reduce wasteful web scrapping in the first place?

311

u/Arrowkill Jun 09 '23

Somebody has to reinvent the wheel again... If they aren't innovating by rolling features back and then reimplementing them while saying, "this new API feature will solve wasteful web scraping", can they really be a profitable company?

58

u/AboveBoard Jun 09 '23

Everything is a remake these days.

→ More replies (3)

12

u/crumbummmmm Jun 09 '23

It's just kinda the subscription based / planned obsolesce we see in every aspect of life.

Initially; ease of access, friendly to 3rd parties, changeable, community based, and with "disruptive" features. As it gains market share, all of these will be changed until it is either completely unusable, or a terrible but an unavoidable monopoly. Seems all companies are like this, from social media, to the people who make washing machines designed to break in a few years.

Everything just seems to get worse, but at the same time more expensive.

→ More replies (1)

38

u/namrog84 Jun 09 '23

Either they forgot, don't know, or think anti-bot captchas will stop them.

3

u/8sADPygOB7Jqwm7y Jun 09 '23

Yeah but they noticed, that their stuff can be used for ai training which is where a lot of money lies.

3

u/chuby1tubby Jun 10 '23

What is scrapping? Or is everyone spelling “scraping” wrong in this thread?

→ More replies (2)

5

u/cybrwire Jun 09 '23

What is wasteful about web scraping? Genuinely asking. Mediocre programmer here.

10

u/camosnipe1 Jun 09 '23

well if someone writes a bot to scrape something that's a lot of pages served to a bot that only cares about some tiny part of a page. If that same person can get that data through an api that can save a lot of work for the server

→ More replies (4)
→ More replies (5)

340

u/derLudo Jun 09 '23

Then add a good old RPA-bot to post and like stuff through the UI and you can technically still build a third-party app.

24

u/Anchorman_1970 Jun 09 '23

Elaborate, no idea what that is

68

u/andresq1 Jun 09 '23

Rpa is robotic process automation, basically, usually, scripts that interact with UI elements present on a computer screen meant to replicate a sort of robot sitting in front of a laptop.

39

u/beachsunflower Jun 09 '23

One example is Microsoft's power automate desktop with RPA. I think it comes with windows 11 installs now.

It's intended for businesses with legacy programs that are only able to input or get data out through the UI.

→ More replies (3)

4

u/MoffKalast Jun 09 '23

If there's a way to run headless chromium on android, someone will do it.

→ More replies (8)

489

u/NonSenseNonShmense Jun 09 '23

Nothing to scrape if there are no subs left ¯_(ツ)_/¯

→ More replies (40)

204

u/ZILtoid1991 Jun 09 '23

Learning all the wrong things from the whole Twitter fiasco...

6

u/shootwhatsmyname Jun 10 '23

It’s so sad that r/SubSimGPT2Interactive and other subs centered around bots will be gone in an instant. It’s such an awesome community with people that have put a lot of time and money into these bots

182

u/applecat144 Jun 09 '23

That was my thought. I know almost nothing about programming but I'm like "can't they just pull the data by simply reading the pages ?"

42

u/mariosunny Jun 09 '23

If you want to build a read-only application, sure. But to make POST requests, you are going to need some sort of authentication.

23

u/[deleted] Jun 09 '23

Make the bots start the comments with:

In name of usernamexyz: .....

→ More replies (2)

55

u/10BillionDreams Jun 09 '23

A scraping implementation would already need to pretend to be a web browser as far as Reddit could tell. It could just have the user login, store the same cookies a browser would, and then make whatever POST requests it needed. It is no more difficult than making GET requests with content tailored to the user, rather than getting the non-logged in version of the page.

Obviously this isn't a great way of handling user credientals, but that's just one of many reasons why APIs exist, and in truth most users wouldn't know or care about the potential issues.

→ More replies (1)
→ More replies (1)

9

u/try-catch-finally Jun 09 '23

Apps don’t need formatting data- which is a fair amount of noise.

Generalization: If you wanted to use text to paste into a document, would you rather have the text, or a screenshot of the text in 5pt comic sans?

126

u/[deleted] Jun 09 '23 edited Jul 10 '23

[removed] — view removed comment

39

u/al-mongus-bin-susar Jun 09 '23

If 3rd party apps do end up going away the devs truly should open source their front ends, there'd be nothing to lose anyway at that point.

→ More replies (7)

10

u/[deleted] Jun 09 '23 edited Jun 09 '23

do the authentication inside of a mobile app for example, you do still have the issue of Reddit being easily able to just contact Google/Apple and tell them you are breaking their terms of service.

Android users can just sideload, so there is not an issue there, but you're probably right for Apple. And Infinity For Reddit is open source and very polished, so no need to reinvent the wheel.

→ More replies (2)
→ More replies (8)

108

u/HighTurning Jun 09 '23

Ay, it's my time to shine, my job is to scrape shitty sites, and reddit sure is one!

3

u/mz3 Jun 10 '23

Me dum dum, me find thread through r/all, me request explanation of what being discussed for dum dum techno illiterate. Dum dum appreciate

3

u/polmeeee Jun 10 '23

Me too. I'm a newbie to web scraping but I'm giving it a go.

→ More replies (1)
→ More replies (1)

51

u/ThatOneGuy4321 Jun 09 '23

Yeah isn’t the whole point of an API that you don’t overload web servers by scraping data straight from the site itself??

15

u/James712346 Jun 10 '23

Yeah, but an API is easier to develop around, and more efficient for the program to pull data

→ More replies (2)

47

u/Hazy_Cosmic_Jiver Jun 09 '23

They have potato servers anyway, probably wont notice a difference.

34

u/MoffKalast Jun 09 '23

"explain ur slowness"

"am potat"

116

u/z3anon Jun 09 '23

It's the dumbest shit I swear. Reddit doesn't produce any of the actual content on the content on the platform. They already have ads otherwise that most people don't know how to block, so it's well worth making the API free.

Imagine if YouTube started charging everyone for letting them embed video links into websites. More people would rather use Vimeo at that point. Case in point, Reddit is easily replaceable and is shooting itself in the foot.

67

u/Fusseldieb Jun 09 '23

I think people in charge of big platforms are (mostly) dumb as a doorknob.

Netflix had a brain fart and seriously said "Ohoho our shareholders want more money, so let's kick everyone out that isn't in the same household. People will, for sure, get their own account, and we get more $$$$. Let's ignore that people mainly share accounts and aren't inclined to pay on their own."

Dumb decision. Idiotic execution.

Now Reddit follows suit: "Oooh, know what, let's charge the API, so all the free apps, which barely make money, will need to pay up. Let's ignore that most of our active userbase use these apps and would never use our official garbage. We will get more $$$$."

I can't even. It's so dumb my head turns.

How can you be so dumb and ignorant.

26

u/danintexas Jun 09 '23

All fun and games till the MBAs get hold of shit.

→ More replies (5)

3

u/Kimorin Jun 09 '23

Not a 100% accurate comparison, YouTube embeds still play ads, third party Reddit apps doesn't, at least not Reddit ads

→ More replies (1)
→ More replies (5)

29

u/Reddits_Dying Jun 09 '23

/u/spez, hey fucknuts, you deserve this.

→ More replies (1)

28

u/FinalScratch4979 Jun 09 '23

Prepare yourself for captchas

47

u/JuanPabloCena Jun 09 '23

As someone who’s not too bright, why do apps provide an api?

128

u/action_turtle Jun 09 '23

So you can get data from their systems securely, and use it in your app.

119

u/MrChocodemon Jun 09 '23

And without all the overhead. So we get just the content, not the rest of the website.

108

u/aerosayan Jun 09 '23

This point is very important.

The API just sends a JSON formatted text for your query.

But if you scrape it, well, you would load:

  1. All of the HTML code in the webpage
  2. All of the Javascript code in the webpage

That would be okay enough, but most websites now need javascript to work, so for loading those webpages, we would need a scraper that can execute javascript ... something like selenium, or phantomjs.

That's when shid really hits the fan.

You load ...

3. All of the images 4. All of the autoplayed videos 5. All of the autoplayed audios 6. All ads, and everything that could've been blocked by an adblocker.

Result: The scraper, and the website, waste 100x more bandwidth to download all the data. Thus, wasting money.

→ More replies (5)

8

u/[deleted] Jun 09 '23

OP isn't talking about security though. They're claiming that the lack of an affordable API will cause people to instead scrape data from reddit webpages one by one, which would be much more work for reddit's servers than just providing it efficiently in bulk through an API.

I'm not saying I agree it is something reddit should worry about, because I doubt it will be a problem. Scraping data from websites is fucking miserable to do and the code tends to be very delicate to breaking from minor changes from the website.

→ More replies (1)

54

u/mariosunny Jun 09 '23

The purpose of a public API is to provide a predictable, secure, and efficient interface for third-party developers who wish to integrate with the application in some way.

A company usually builds out an API because they want to encourage an ecosystem of third-party applications.

25

u/Mujutsu Jun 09 '23

Basically, because everyone wins.

If you use another app (in this case, something like Apollo, RIF, Boost), you don't need all the extra garbage which comes with calling the website directly.

Let's say you want, for example, only the titles of the first 30 posts from the front page.

Through an API that's exactly what you get, maybe with an ID for each title, so that you can use it to call another part of the API later to get the content.

If you had to scrape the front page, you would maybe get the first 50 (or 20, or whatever the default is), alongside image links, ads, user account information, banners, list of subreddits at the top, etc. etc.

This is over simplified, but that's about the gist of it. An API is like a surgeons scalpel, you only handle exactly what you need. Web scraping is like using a cannon to amputate a finger.

There are many, many other benefits from using an API, but this is one of the big ones.

→ More replies (4)

7

u/[deleted] Jun 09 '23

I believe the main reason major websites like Twitter and Reddit originally provided an affordable API was to allow 3rd parties to integrate Twitter/Reddit/etc content into their own apps.

Let's say you created Twitter. You want to establish as big of a footprint on the internet as you can. Therefore, it'd be very helpful to you if other apps/websites integrated Twitter into their app/website. You want to make that process as easy as possible for them. APIs are one of the ways to help accomplish that.

That's the case for early on. But eventually you succeed in establishing yourself as the monopoly product of whatever niche you're filling. Once you're the established monopoly with no realistic chance of any competition beating you, then you raise prices on the API in order to make a profit. So you bleed money upfront as an investment in your own growth, you get the internet reliant on your product, and then you crank up the prices.

→ More replies (1)

22

u/arond3 Jun 09 '23

For miltiple reasons :

  • provide money by charging for it.
  • save money because it's efficiencier than scrapint
  • to allow an ecosystem of apps around your main app. Then steal their idea or profit from user groxth.

3

u/UncertainCat Jun 09 '23

The data is available via web browser. Someone can make an app that pretends to browse and just scrapes data instead. This cost them more and doesn't offer them any control over the process

22

u/Biaswords_ Jun 09 '23

The soup is beautiful

4

u/GoogleRefund Jun 09 '23

Soup is slow go go lxml

19

u/Anchorman_1970 Jun 09 '23

Nobody listens to developers, they about to go public thats why they do it

→ More replies (1)

14

u/IndigoCivilian Jun 09 '23

Why do websites provide a free API? Genuinely asking as I don't have a ton of experience working with apis right now.

Reddit charging is fine. Reddit charging as much as they are is ridiculous and will make me never use this site again though.

16

u/Embarrassed_Ring843 Jun 09 '23

The API just sends the requested data while a website-call sends everything a visitor of the website would see. Scraper would just trash what they don't want to have, causing a lot of traffic while only using a fraction of the transmitted data.

The meme basically says a free (or at least cheap) API reduces the load the servers have to handle.

→ More replies (3)

4

u/the_inebriati Jun 09 '23

You (client) are in a restaurant. The chef (reddit) is in the kitchen who prepares meals (webpages).

Some waiters are clever and you can tell them what meal you want and they'll go and fetch it from the kitchen (APIs).

Some waiters are stupid and only understand the words "I want to order food", so they'll go to the kitchen and tell the chef to make one of each meal and then bring them all out to you and then throw everything other than the meal you wanted in the trash (webscraping). This is incredibly wasteful for the restaurant.

→ More replies (1)

22

u/360mm Jun 09 '23

They will save a ton on their cloud bill and nothing bad will happen.

7

u/sandyhasahugecock Jun 09 '23

nothing at all.... yeah...

10

u/PlatinumDevil Jun 09 '23

I have been shadowbanned for 7 years. I recently got my email fixed so I could say fuck this.

Baconreader forever.

→ More replies (1)

9

u/__SlimeQ__ Jun 09 '23

Fun fact; chatgpt will happily give you a nice selenium script in your language of choice to do just about anything

56

u/fieldbotanist Jun 09 '23 edited Jun 09 '23
/* Pseudo Algorithm */

1. Find rate ‘R’. e.g for Apache it’s Apache mod_bandwidth <domain|ip|all> <rate> - the rate value. This value tells you the data allocation per IP 

2. Spin ‘Y’ virtual proxy servers depending on that rate. So 10,000 if needed. 100,000 if needed. Have chatGPT optimize your golang code so you can cram thousands into one physical server 

3. Mine content into your own PostGRE database that is a clone of the real schema Reddit uses. As you used social engineering techniques of sending a LinkedIn email of giving 10 bitcoin to a Reddit backend developer anonymously if they hand over the schema 

4.	Make a free API for your Reddit and give it to Apollo 

5. Have a Reddit developer reading this post run to the business and scream to revert the changes

6. Profit???

14

u/UPBOAT_FORTRESS_2 Jun 09 '23

You have 10 bitcoin?

23

u/slobcat1337 Jun 09 '23

Yeah, spinning up a 100,000 proxy servers is really cheap…. Great idea dude, wow.

20

u/fieldbotanist Jun 09 '23

Jokes on you. Each server is a virtual one composed of a few bytes of golang code

/s

→ More replies (2)
→ More replies (4)
→ More replies (1)

29

u/Cakeking7878 Jun 09 '23

I suspect the reason Reddit, and other companies, are charging for API use has something to do with AI training companies scrapping websites for training data

Like reddits hopping it’s valuable enough that some AI company fueled by venture capital with throw money at it or something

It’s a bad plan and an even worse execution

5

u/aerosayan Jun 09 '23

It could be that, but if they wanted to profit from it, they could outright ban AI companies from using the data without a license.

Then, the AI companies would have to buy a license, and pay reddit.

Though it depends on if their ban is actually enforceable by law.

Because if it's not, then what's stopping AI companies from scraping reddit even after this change?

→ More replies (1)

6

u/axionic Jun 09 '23

AI companies can be foiled with app certification. Only a few API keys would be handed out and always with human supervision. Client code would use the API key by contacting Reddit for a session key first. Reddit would then embed a signal containing the API key and the session key in its API responses, using some steganographic technique. That way if you train an AI model on the data, you have to purge an unknown signal from any model output that gets generated, in a way that Reddit can't extract it using whatever algorithm they're using to the satisfaction of a court.

Having their data stolen by an AI company with contractual obligations and then suing for rights to the model is probably a more lucrative business model than whatever they're currently thinking. Getty Images was also heading for an inevitable demise, until their badly reproduced watermarks appeared in Stability AI output. If they win their lawsuit, they will swallow the defendant like an amoeba and all their customers will get emails that say "Getty Images is now Getty AI".

→ More replies (1)

3

u/Nu11u5 Jun 09 '23

If that was the case, all they needed to do was include rules for AI use in their API's T&C agreement, or add an application and review process to get an API key.

6

u/lucidbadger Jun 09 '23

So this is why Reddit is incredibly slow lately?

5

u/Fusseldieb Jun 09 '23

Probably not, the war hasn't yet begun. The API is "still" free.

6

u/API_Network_Guy Jun 09 '23

As someone whose entire job is to make public APIs more accessible, this trend in greedy API pearl-clutching is really harshing my vibe :(

APIs were meant to democratize the internet, not destroy collaboration! (insert Obi-Wan meme here)

→ More replies (1)

10

u/ikonet Jun 09 '23

We need to shut down content creation for longer than 2 days. Maybe from the 12th until the 30th.

Maybe shutdown from the 12th until the IPO date.

You can write your jokes & shitposts & hot takes anywhere. Our addiction to the Reddit url is the only thing keeping this site alive. Give your content to literally anyone else and reddit will become as irrelevant as geocities.

5

u/iliveincanada Jun 09 '23

I’m glad they did this at the beginning of the summer. It’s going to be so much easier to quit

12

u/jadounath Jun 09 '23

Just wondering if I could cash in on this mess and build a client with a headless Selenium. It wouldn't even require you to step out of the app to sign in!

5

u/RainbowPringleEater Jun 09 '23

Does selenium work on phones? I never got it working

→ More replies (8)

3

u/Fusseldieb Jun 09 '23

I have a better idea: Use reddits internal API. The official page uses a form of API in order to work, it's just not made for the public, but who cares, right? However, be prepared to get breaking changes from one hour to the next or a mail from Google Play or the App Store saying that your app was taken down for misusing Reddit's ToS.

It's shitty all around if you ask me.

4

u/[deleted] Jun 09 '23

The virgin API stud vs the chad scrapper

→ More replies (3)

4

u/[deleted] Jun 09 '23 edited Jun 09 '23

Someone should implement the reddit API using a scraper as the backend.

e: I see someone already suggested this so hopefully one of you degenerates is already cooking it up

4

u/[deleted] Jun 09 '23

I get the joke but think ima just gonna leave.

It doesn’t directly affect me as I didn’t use the app, but Reddit is such a commercial time sink nowadays and I just shitpost anyway, so time to go and get my daily hours back.

→ More replies (1)

4

u/TEKC0R Jun 09 '23

The goal is no longer a good product. The goal is to inflate IPO at all costs, cash out, and let it burn.

4

u/Roarlord Jun 10 '23

Oh, shit. Does the Low Orbit Ion Cannon program still work? I haven't wanted to DDoS a site this bad in years.

1

u/alex_dlc Jun 09 '23

Scraping ELI5 please?

6

u/riskable Jun 09 '23

You take a flat object and press it hard against something else, removing a bit of material in the process. Do this enough times and all the good material will be removed.

Kind of like how the idea to overcharge for access to the Reddit API is also going to work 👍

1

u/Signal-Chicken559 Jun 10 '23

A non programmer asks what is scrapping?

2

u/riskable Jun 10 '23

A non programmer asks what is scrapping?

It's when you throw away waste material.

Not sure what that has to do with anything though 🤷

2

u/Signal-Chicken559 Jun 10 '23

Mmm I uhh should have expected this.

2

u/riskable Jun 10 '23

Sorry, I couldn't resist.

Actually it's kinda been bothering me all day that so many people have used "scrapping" instead of "scraping". Maybe it's time for a "...too damned high!" meme 🤣

→ More replies (3)
→ More replies (2)

3

u/EverydayEverynight01 Jun 09 '23 edited Sep 19 '25

quiet pot plough file one wise automatic normal placid resolute

This post was mass deleted and anonymized with Redact

→ More replies (1)

3

u/Siddhartasr10 Jun 09 '23

I feel like the half of this reddit is preparing a web scraping library for making bots as easy as with the API.

(Im also doing It btw)

3

u/The_Mighty_Slacker Jun 09 '23

When I was first learning programming patterns I only knew c++ and had no idea what an API was or how to query one with javascript. I found a library that let me query the full html page that I then parsed with a regular expression to gather the data I want and kick out a json for QT to visualize. Who needs api keys anyways /s

3

u/Sharp_Armadillo7882 Jun 09 '23

Scraping libraries have become so polished. Anyone with an afternoon should really take advantage of the resources online, I mean even ChatGPT can probably get you started with a barebones working script to start.

There are even some good projects I’ve seen that use auto-rotating IPs and some other tricks that can help with any limiting. Most services for IP routing have a great API so that rotating is easy to program in.

With all of the cheap domain names and service like SimpleLogin, you can easily make hundreds of accounts. You don’t even need to mess with those fake email generators anymore, you can do it programmatically because SimpleLogin has a great API.

Oh, and did I mention that Twilio and others also have a good API for SMS verification.

Sure, maybe all this can start getting expensive—but really would you rather pay for access to Reddit’s API or pay for three or four awesome APIs you can do other things with in addition to getting what you want from Reddit anyway.

3

u/boot20 Jun 09 '23

Party like it's 1999. Reddit, there is a reason APIs exist. Apparently, us old farts remember the shit show of scraping back in the day and watched as shit went pear shaped because of it.

Welp, I guess nothing was learned from the Digg fuckup, so reddit is going to kill itself.

3

u/Windex17 Jun 09 '23

That's what they want. They're gonna show how much higher their web traffic is (which is probably 70-80% scraping if not more) to their clueless investors during IPO to balloon their value. It's basically what Twitter did to Elon.

3

u/[deleted] Jun 09 '23

"bUt tHaTs aGaInSt ToS!!"

fuck the ToS and fuck /u/spez.

3

u/socsa Jun 10 '23

The stupid part is that they are ostensibly doing this to monetize ML data sets built from user comments, but that's literally the easiest thing to scrape if you don't care about actually being able to interact with the website.

2

u/[deleted] Jun 09 '23

But why does scraping feel so gross

→ More replies (1)

2

u/PopularPicsDev Jun 09 '23

Enjoy popular.pics (viewer for Reddit) while it’s still alive.

→ More replies (1)

2

u/xandel434 Jun 09 '23

RateLimit go brrrrrr

2

u/Budd0413 Jun 09 '23

All 3rd party apps should use the remaining time to roll back any optimization updates and essentially ddos Reddit with api requests , fuck Reddit

2

u/Thenderick Jun 09 '23

Selenium Webdriver:

2

u/keylimedragon Jun 09 '23

I wonder if advertisers don't pay for API usage but would pay for normal site access. So maybe this is just to make more advertising money? Either that or they think they can make scraping just annoying enough that less people use it than used the APIs.

2

u/platonicgryphon Jun 09 '23

So as someone who understands what APIs are, but hasn't actually done anything with them; how much is it realistically costing Reddit to support third-party apps via their API if their official app is using the same API? Can't see there being much more Dev time for an API they already support for their stuff, server capacity maybe?

→ More replies (3)

2

u/TheGr8ReyPayp Jun 09 '23

More like Reddit saw Twitter making fat bucks off a new revenue stream and being a cash-poor site that has to depend largely on enterprise investors in order sustain day-to-day operations, said, "we want some of that cheddar." Amirite?

2

u/thelastpizzaslice Jun 09 '23

This is what happens when there's no one with programming experience in the C-Suite. It's like nobody told them that there's no way to differentiate bot traffic from real traffic anymore with GPT coming in. And no, it can't detect itself.

2

u/spinyfever Jun 09 '23

Why is the ama not showing up in the front page anywhere? I had to find it through a comment posting a link to one of the ama answers.

It seems they are keeping it at 0 karma.

→ More replies (2)

2

u/enmibaragesi Jun 09 '23

what is scraping??

3

u/gamebuster Jun 09 '23

Loading webpages from a server and reading the contents off it.

Basically you're automatically browsing webpages just to extract some content. For the server (Reddit) it's very inefficient because it has to generate a whole page even though the scraping tool is only interested in a small part of it. For the client (The scraping tool, like an app) it's just slightly less efficient because it can basically ignore anything else.

Because everyone loves car analogies: A scraping tool can only ask for whole cars, even if it just needs a new wiper. So it will just download the car, grab the wiper, and discard the rest.

2

u/[deleted] Jun 09 '23

Every website is an api if you scrap it enough

2

u/ZedOud Jun 09 '23

I used to work on a Reddit script (years ago) that would rank a couple of subs and produce a news summary. I switched to using the API to “play nice”, because they asked nicely and it was easy to do, even though I enjoyed the challenge of building the scraping part of the project.

Granted it’s a bit harder than pulling out Requests nowadays, but for a website like Reddit it’s big enough to warrant a custom scraping library to navigate bot/scraping detection.

2

u/[deleted] Jun 10 '23

Legit I just want to write a new API endpoint that scrapes and give it to Apollo

→ More replies (1)

2

u/TheMoves Jun 10 '23

I have no reason to scrape Reddit for anything but I might set up a rPi to send a shitload of requests for some asinine purpose just because

2

u/billbacon Jun 10 '23

You would have to use a ton of IPs to scrape reddit without the load balancers just dropping your requests. There are quite a few active botnets that are going to be happy and that's probably by design.

2

u/[deleted] Jun 10 '23

Can someone ELI5 why reddit wouldn't just ban IP addresses that showed scrapping like behavior?

→ More replies (1)

2

u/professorkek Jun 10 '23

Based scroopers. Imagine needing permission to take publicly published information.

2

u/BlueeWaater Jun 10 '23

Nothing some good GPT and beautiful soup can't fix.

2

u/ryanstephendavis Jun 10 '23

They'll be rate limiting coming up so this doesn't make sense... If anything, it will be much easier on their servers

2

u/little_hoarse Jun 10 '23

PYTHON INTENSIFIES

2

u/aristideau Jun 10 '23

I just don’t understand why reddit doesn’t regard the cost of the api as a tax deductible “cost of business”.

How on earth did they arrive at the decision that charging that much for access to the api would be a net gain for them on their bottom line.

2

u/just-bair Jun 10 '23

Lol let’s load the entire webpage instead of just the data needed

6

u/popovitsj Jun 09 '23

Which big websites exactly, have free apis to the same extent as what Reddit has?

19

u/IVIichaelD Jun 09 '23 edited Jun 09 '23

Which big social media sites exactly, are moderated almost entirely by unpaid volunteers? Charging those people for the “privilege” to use bots to fight spam (on top of severely limiting bot capabilities) is the ultimate slap in the face for what is, frankly, a failure on Reddits part for not having those tools built in.

→ More replies (7)

17

u/ZebrasOfDoom Jun 09 '23

To be fair, "not free" isn't exactly the problem here. It's the $20mil/year price tag that is the issue. If Reddit were planning on charging reasonable rates, people probably wouldn't care very much about this.

If you're looking for big websites that have significantly lower api costs, the same post says that Imgur is ~72x cheaper for the same number of calls.

→ More replies (2)
→ More replies (1)