- Source:
Methods
(static) download_raw(url, parseDataCallback)
- Source:
This function downloads data from the URL input as JSON
Parameters:
| Name | Type | Description |
|---|---|---|
url |
string | The url of the reddit post. |
parseDataCallback |
function | A callback which parses the downloaded data. If data is null, an error has occurred. |
(static) extract_urls(post)
- Source:
The extract_urls function looks up text and extracts urls into a list.
Parameters:
| Name | Type | Description |
|---|---|---|
post |
array | The list of urls. |
(static) handle_http_response(url, http_request, callback)
- Source:
The handle_http_response function checks the ready state of the request and responds appropriately.
Parameters:
| Name | Type | Description |
|---|---|---|
url |
string | The url of the page. |
http_request |
object | The http request. |
callback |
function | A callback function called when the request is finished. |
(static) process_links(data, proccessed, onComplete)
- Source:
The proccess_links function analyses the links within a post and queries to pushshift to extract data and determine occurences of these links across reddit.
Parameters:
| Name | Type | Description |
|---|---|---|
data |
string | The raw json data. |
proccessed |
string | The processed json data. |
onComplete |
function | The callback function executed when processing of links is finished. |
(static) process_meta(data, proccessed)
- Source:
The proccess_meta function updates the processed json data in order for it to be displayed on the html page.
Parameters:
| Name | Type | Description |
|---|---|---|
data |
object | The original post data. |
proccessed |
object | The processed json data. |
(static) process_raw(raw_json, onStageComplete, process_duplicates)
- Source:
Takes the raw json data and processes it to a form ready for further data manipulation.
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
raw_json |
string | The original post data. |
|
onStageComplete |
function | Callback function that is called when each stage is completed. |
|
process_duplicates |
boolean |
true
|
Makes sure reposts aren't infinitely processed. |
(static) process_reposts(data, proccesed, onComplete)
- Source:
The proccess_reposts function proccesses all commenters in a post and finds the data of each commenters previous comments on different subreddits.
Parameters:
| Name | Type | Description |
|---|---|---|
data |
object | The original post data. |
proccesed |
object | The processed json data. |
onComplete |
function | The callback function that is executed when reposts have been processed. |
(static) recurseComments(processed, children, moreComments, onComplete)
- Source:
Processes all commenters in a post and finds the data of each commenters previous comments on different subreddits
Parameters:
| Name | Type | Description |
|---|---|---|
processed |
object | The processed JSON data. |
children |
object | The JSON data. |
moreComments |
array | Additional comment thread ids. |
onComplete |
function | The callback function to be executed when all comments have been processed. |
(static) retry_request(url, original_request, callback)
- Source:
The retry_request function takes the url and tries to make an HTTP request up to three times with a 500ms delay.
Parameters:
| Name | Type | Description |
|---|---|---|
url |
string | The url of the page. |
original_request |
string | The original request. |
callback |
function | A callback function called when the request is finished. |
(static) setAsync(async)
- Source:
This function toggles the download between synchronous to asynchronous.
Parameters:
| Name | Type | Description |
|---|---|---|
async |
boolean | Makes downloads synchronous or asynchronous. |