Skip to content

Commit f3ab753

Browse files
committed
fix(sources): speedrun.com fetching runs without videos
1 parent 6b97632 commit f3ab753

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

background/sources/collections/speedrundotcom.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ export default async () => {
9797

9898
const addMetaToRun = async (run) => {
9999
const meta = await getMetaForRun(run.url);
100+
if (!meta) { return false; }
100101
run.url = meta.url;
101102
run.desc = meta.desc;
102103
const results = await Promise.all([

background/sources/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ const sources = {
4848
cachedResults[type][source] = videos;
4949
} catch (err) {
5050
console.warn(`Failed to get videos for ${source}: ${err.message}`);
51+
console.error(err);
5152

5253
// Fallback to cached videos from this source if getting videos fails.
5354
videos = cachedResults[type][source] || [];
@@ -150,6 +151,7 @@ const sources = {
150151
if (!meta) { return false; }
151152
} catch (err) {
152153
console.warn('Failed to get meta for video: ' + video.url);
154+
console.error(err);
153155
return false;
154156
}
155157
video.url = meta.url;

background/util.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,7 @@ export const isSameVideo = (video1, video2) => {
199199
*/
200200
export const parallelFilter = async (args, func) => {
201201
const results = await Promise.all(args.map(func));
202-
const filteredList = [];
203-
results.forEach((pass, i) => {
204-
filteredList[i] = args[i];
205-
});
206-
return filteredList.filter(d => !!d);
202+
return args.filter((arg, i) => results[i]);
207203
};
208204

209205
/**

0 commit comments

Comments
 (0)