diff --git a/src/api/pushshift/index.js b/src/api/pushshift/index.js index eaf3328..66d55e3 100644 --- a/src/api/pushshift/index.js +++ b/src/api/pushshift/index.js @@ -88,12 +88,14 @@ export const getComments = async (callback, threadID, maxComments, after) => { if (delay >= 8000) // after ~16s of consecutive failures errorHandler('Could not get removed comments', error, 'pushshift.getComments') // rethrows delay = delay * 2 || 125 - console.log('pushshift.getComments delay: ' + delay) pushshiftTokenBucket.setNextAvail(delay) + if (!callback([])) + return [ lastCreatedUtc, false ] + console.log('pushshift.getComments delay: ' + delay) } } const comments = response.data - const exitEarly = callback(comments.map(c => ({ + const exitEarly = !callback(comments.map(c => ({ ...c, parent_id: c.parent_id?.substring(3) || threadID, link_id: c.link_id?.substring(3) || threadID diff --git a/src/api/reddit/index.js b/src/api/reddit/index.js index ff221af..76f4967 100644 --- a/src/api/reddit/index.js +++ b/src/api/reddit/index.js @@ -7,6 +7,7 @@ const requestSettings = {headers: {"Accept-Language": "en"}} const errorHandler = (origError, from) => { console.error(from + ': ' + origError) const error = new Error('Could not connect to Reddit') + error.origError = origError if (origError.name == 'TypeError') { // The exception when blocked by Tracking Protection // https://stackoverflow.com/a/9851769 const isFirefox = typeof InstallTrigger !== 'undefined' diff --git a/src/pages/common/Post.js b/src/pages/common/Post.js index 0f2458b..3d98971 100644 --- a/src/pages/common/Post.js +++ b/src/pages/common/Post.js @@ -4,7 +4,27 @@ import { prettyScore, prettyDate, prettyTimeDiff, exactDateTime, parse, redditTh export default (props) => { if (!props.title) { - return
+ if (props.removed) { + const permalink = `/r/${props.subreddit}/comments/${props.id}` + return ( + + ) + } else + return } const url = props.url.replace('https://www.reddit.com', '') @@ -41,7 +61,7 @@ export default (props) => { const [showEdited, setShowEdited] = useState(false) return ( -