How do I extract information from Reddit?

How do I extract information from Reddit?

I want to pull the information from r/technology, specifically some of the comments. Right now I'm storing all of the comments in one giant string. Any idea on how to go about extracting out the information that I'm looking for?
String fullComment = "Hello this is a comment. Hello this is another comment. Goodbye.";

I'm wanting to pull out the "goodbye." out of the string. Is there an easy way to do this? I'm using C# if that matters.

The problem with a large string is the time it takes to loop through it - when you do this, the text that you want is behind the whole rest of the string. You can store parts of the string in an ArrayList and then extract only what you want from it. Then display the desired part of it by simply returning it to the text box and it will show up right in front of where you need it. Here is an example (assuming that your list is named commentsList)
string fullComment = "Hello this is a comment."; ArrayList commentsList = new ArrayList();. commentsList.Add(fullComment.Substring(0, fullComment.IndexOf("goodbye.")));
commentsList.Add(fullComment.Substring(fullComment.IndexOf("goodbye.")));
Console.

Can you scrape a subreddit?

A quick look at the Reddit API will show you that it's possible to have your own web scraper and post a new thread. However, most web scrapers have issues scraping Reddit and you don't want to be responsible for banning anyone or getting banned yourself.

What is ScrapeBox? ScrapeBox is a multi-purpose web scraping tool, but it also has a Reddit scraping feature that uses both its own API and Reddit's official API. It uses the "paulirish/headless-chrome" module of NodeJS.

In addition to running on a server, ScrapeBox can run headless on your local machine (via Xvfb) or remotely (via SSH). The Reddit feature is free and you can use it to scrape any subreddit, including private ones, or create a new subreddit. How do I scrape a subreddit? ScrapeBox contains all the necessary code to scrape a subreddit. How do I scrape Reddit from ScrapeBox? The API is a relatively straightforward POST request that requires a bit of documentation and coding. You can refer to the Reddit API page for information on the method to use.

We'll make an API request that returns the title, URL, and first comment of every post in the subreddit you specify, like so: import requests import pprint def apirequest(apiurl, subreddit): """API request: gets data for a subreddit""" payload = r = requests.post(apiurl, data=payload) print pprint.pprint(r.json())

You can pass in a list of subreddits to scrape and get back all the posts in those subreddits.

Related Answers

Whats the best VPN for privacy Reddit recommends?

I will not spend time or money on a VPN. I simply do not need a VPN....

Whats the best VPN for privacy Reddit recommends?

I'm looking for a good VPN. I use the default settings (PPTP), and I'm...

What Is a Reddit Scraper?

Yes! We can scrape a subreddit and save it as a text file. Can you scrap...