Skip to content

Commit 5eeb8a2

Browse files
committed
fix(sources): fix getting correct relative urls in haloruns
1 parent 1877253 commit 5eeb8a2

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

background/sources/collections/haloruns.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
import * as util from '../../util.js';
22

33

4+
const RECORDS_PAGE = 'https://haloruns.com/records?recent';
5+
const resolveLink = ($link) => {
6+
return new URL($link.getAttribute('href'), RECORDS_PAGE).href;
7+
};
8+
49
export default async () => {
5-
const body = await util.ajax('https://haloruns.com/records?recent');
10+
const body = await util.ajax(RECORDS_PAGE);
611
let $items = body.getElementById('recentWRTable');
712
if (!$items) {
813
throw Error('Error retrieving videos');
@@ -37,16 +42,15 @@ export default async () => {
3742
let $newUser = $col4.children[1].children[0];
3843
let timeSaved = $col5.textContent.replace(' : ', ':');
3944

40-
let url = $newRecord.href;
4145
items.push({
4246
col: {
43-
url: $level.href,
47+
url: resolveLink($level),
4448
users: [{
45-
url: $newUser.href,
49+
url: resolveLink($newUser),
4650
name: $newUser.textContent,
4751
}],
4852
},
49-
url: url,
53+
url: resolveLink($newRecord),
5054
thumbnail: null,
5155
length: util.timeToSeconds($newRecord.textContent),
5256
title: game + ' ' + difficulty + ' - ' + $level.textContent +

0 commit comments

Comments
 (0)