+
https://hubdrive.space/file/2243124026
++
diff --git a/src/extractor/HubDrive.test.ts b/src/extractor/HubDrive.test.ts index af3a214..8935c50 100644 --- a/src/extractor/HubDrive.test.ts +++ b/src/extractor/HubDrive.test.ts @@ -22,4 +22,8 @@ describe('HubDrive', () => { test('handle avatar', async () => { expect(await extractorRegistry.handle(ctx, new URL('https://hubdrive.space/file/7283903021'))).toMatchSnapshot(); }); + + test('handle missing hubcloud', async () => { + expect(await extractorRegistry.handle(ctx, new URL('https://hubdrive.space/file/2243124026'))).toMatchSnapshot(); + }); }); diff --git a/src/extractor/HubDrive.ts b/src/extractor/HubDrive.ts index c4f2480..69d1622 100644 --- a/src/extractor/HubDrive.ts +++ b/src/extractor/HubDrive.ts @@ -31,8 +31,10 @@ export class HubDrive extends Extractor { const html = await this.fetcher.text(ctx, url, { headers }); const $ = cheerio.load(html); - const hubCloudUrl = new URL($('a:contains("HubCloud")').attr('href') as string); + const hubCloudUrl = $('a:contains("HubCloud")') + .map((_i, el) => new URL($(el).attr('href') as string)) + .get(0); - return this.hubCloud.extract(ctx, hubCloudUrl, meta); + return hubCloudUrl ? this.hubCloud.extract(ctx, hubCloudUrl, meta) : []; }; } diff --git a/src/extractor/__fixtures__/HubDrive/https:hubdrive.spacefile2243124026 b/src/extractor/__fixtures__/HubDrive/https:hubdrive.spacefile2243124026 new file mode 100644 index 0000000..7f4ede8 --- /dev/null +++ b/src/extractor/__fixtures__/HubDrive/https:hubdrive.spacefile2243124026 @@ -0,0 +1,512 @@ + + +
+ + + + + + + + + + + + + + + + +| File Size | +3.77 GB | +
| File Type | +video/x-matroska | +
| File Owner | +dhub 2 | +
https://hubdrive.space/file/2243124026
+