Commit graph

27 commits

Author SHA1 Message Date
Christopher Gurnee
08991dfbb0 Work around Pushshift bug for certain time ranges
Comments in the time ranges below need a workaround which slows down
Pushshift queries, but it's required to retrieve them correctly

 * Sep/1/2017 0:00 - Sep/30/2017 23:59:59 UTC
 * Feb/1/2018 0:00 - Mar/31/2018 23:59:59 UTC
2022-05-09 20:07:12 +00:00
Christopher Gurnee
31dc89bf13 Make error message a bit more clear 2022-03-21 15:58:32 +00:00
Christopher Gurnee
0abf9222fb Improve permalinks and add parent link to comments
Beforehand, visiting a permalink would cause Unddit to begin loading
from the Post's first comment. If the max-to-download setting was too
small, and the permalinked comment wasn't yet encountered, no comment
tree would be displayed.

Now, only comments that occur at the same time as the permalinked
comment or later (chronologically) are downloaded.

This also adds a Parent link to each comment. When viewing a permalinked
comment, clicking the top-level Parent link will download only new
comments between the parent and child comments. Likewise, clicking the
'view rest of comments' link will only download new comments from the
first comment up until the previously viewed comment.

In general, Unddit will not re-download comments that it knows it has
previously downloaded, nor download more than max-to-download comments
per link clicked. This can leave 'gaps' in the list of downloaded
comments. If the 'load more comments' link is clicked, Unddit will only
download comments that can fill such gaps between the currently-linked
permalink (or if not viewing one, the first comment) and the last, up to
the max-to-download setting.
2022-03-18 23:56:10 +00:00
Christopher Gurnee
2d436062ce Improve error handling 2022-03-18 23:53:31 +00:00
Christopher Gurnee
942bee0a96 Add *edited link to toggle archived/reddit post 2022-03-16 21:54:58 +00:00
Christopher Gurnee
456b212d5f Use Pushshift metadata to see if loadedAllComments
This saves one Pushshift request on about half of all (re-)loads
2022-03-16 21:54:58 +00:00
Christopher Gurnee
0081278e3c Replace maxComments in state w/loadingMoreComments
maxComments is now only the user-preferred setting, and has nothing to
do with displayed state. loadingMoreComments is used to trigger loading
more comments, and temporarily contains the desired comment count to
load. This should make future changes easier. Also fix two minor bugs:

 * the 'Reload' was sometimes hidden after clicking 'load more comments'
 * 'loaded x more comments' incorrectly appeared after clicking 'Reload'
2022-03-16 21:54:47 +00:00
Christopher Gurnee
c236bf3e5a Refactor thread/index.js w/more parallelism/speed
Beforehand, Pushshift comments were all downloaded first, then they were
processed, then all Reddit comments were downloaded, then processed.
Now, as each batch of Pushshift comments completes, it is processed
asynchronously, and Reddit comments are downloaded & processed as soon
as enough comment IDs have been batched for submission. This minimizes
the amount of time spent in the 'Comparing comments to Reddit API'
phase. It also spaces out Reddit API requests for better netiquette.
2022-03-03 14:10:20 -05:00
Christopher Gurnee
d93815ae73 Improve error handling and move it to API layer 2022-03-03 09:10:35 -05:00
Christopher Gurnee
52d8d69d90 Fix bug/typo in 6d1600f 2022-03-02 16:39:33 -05:00
Christopher Gurnee
fb327e7b94 Fix bug w/0-comment posts introduced in 07c72a2 2022-02-25 13:25:02 -05:00
Christopher Gurnee
cab177c021 Refactor state.js a bit 2022-02-25 10:27:33 -05:00
Christopher Gurnee
aac22ce109 Speed up and clarify the 'load more comments' UI
* only rerender the comments after loading and iff something changes
 * change text to 'loading...' and make link unclickable while waiting
 * if all comments are already loaded, rename to 'load new comments'
2022-02-22 11:56:53 -05:00
Christopher Gurnee
07c72a2e41 Skip reloading existing comments from Pushshift 2022-02-19 13:27:40 -05:00
Christopher Gurnee
6d1600ff01 Use a token bucket to rate-limit the Pushshift API
Queries to Pushshift will now be started about as quickly as
permitted, while also reducing 429 responses to a minimum.
2022-02-19 10:28:27 -05:00
Christopher Gurnee
c98f71bd4d Rewrite api/pushsift/index.js using async/await
* much simpler, got rid of recursion
 * no more Set temporaries, less copying of arrays
 * now returns a Map (thread/index.js need not create it)
2022-02-19 10:25:27 -05:00
Christopher Gurnee
e13b68f90f Add "max. comments to download" setting 2021-12-01 13:06:01 -05:00
Christopher Gurnee
842061ef2b More detailed console error messages for debugging 2021-11-03 16:48:18 -04:00
Christopher Gurnee
d9c46d00e7 Be more descriptive with removed comments 2021-10-23 12:58:06 -04:00
Christopher Gurnee
c8b0ac8523 Update the endpoint to api.pushsift.io v4
Also update the reddit endpoint for posts, and add the capability
to download from Pushshift in multiple batches, with a binary
backoff; it's currently set to download up to 1,000 comments.

Credit (once again) to @ayan4m1 for a couple snippets of code.
2021-10-16 13:50:08 -04:00
JubbeArt
9568e49c41 25k comments from Pushshift apperently craches the site, changed to 20k instead 2018-08-26 00:44:58 +02:00
JubbeArt
e945ef4c73 Changed retrived comments from Pushshift to 25k from 10k 2018-08-26 00:30:46 +02:00
JubbeArt
c039a67b76 Now shows errors from API in the status box 2018-07-28 21:14:13 +02:00
JubbeArt
d65cbe0d9a Added readable error messages for all the APIs 2018-07-28 20:56:05 +02:00
JubbeArt
9a151080e1 Replaced absolute import paths with relative paths 2018-07-28 16:58:45 +02:00
JubbeArt
2f40c15c7f Simplified mutiple parts of the api module to reddit/pushshift 2018-07-15 01:13:31 +02:00
JubbeArt
ea3acd2584 Changed structure to work better with webpack 4s default config 2018-07-14 23:24:23 +02:00