Skip to content

Commit d4d5aaa

Browse files
committed
fix: anghami source search term and artwork url
1 parent 9847638 commit d4d5aaa

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/sources/anghami.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default class AnghamiSource {
44
constructor(nodelink) {
55
this.nodelink = nodelink
66
this.config = nodelink.options
7-
this.searchTerms = ['anghamisearch']
7+
this.searchTerms = ['agsearch']
88
this.patterns = [
99
/^https?:\/\/(?:play\.|www\.)?anghami\.com\/(?:song|album|playlist|artist)\/(\d+)/
1010
]
@@ -335,18 +335,19 @@ export default class AnghamiSource {
335335
}
336336

337337
buildTrack(item) {
338-
const artworkUrl = item.coverArt
339-
? `https://angartwork.akamaized.net/?id=${item.coverArt}&size=640`
338+
const artworkId = item.coverArt || item.AlbumArt || item.cover
339+
const artworkUrl = artworkId
340+
? `https://artwork.anghcdn.co/?id=${artworkId}&size=640`
340341
: null
341342

342343
const trackInfo = {
343344
identifier: item.id.toString(),
344345
isSeekable: true,
345-
author: item.artist,
346-
length: Math.round(parseFloat(item.duration) * 1000),
346+
author: item.artist || item.artistName || 'Unknown Artist',
347+
length: Math.round(parseFloat(item.duration || 0) * 1000),
347348
isStream: false,
348349
position: 0,
349-
title: item.title,
350+
title: item.title || item.name,
350351
uri: `https://play.anghami.com/song/${item.id}`,
351352
artworkUrl: artworkUrl,
352353
isrc: null,
@@ -535,4 +536,4 @@ class Reader {
535536
throw new Error("Unknown wire type: " + wireType);
536537
}
537538
}
538-
}
539+
}

0 commit comments

Comments
 (0)