JsOsaDAS1.001.00bplist00ÑVscript_dconst internals = { /** * Config. In most of the cases, you'll only have to modify values here. */ config: { /** * Set this to the name of the account you wish to use. Only supports feeds in the same account. */ account: "iCloud", /** * Set this to your music folder. Only supports feeds in the same folder. */ musicFolder: "155 - music", /** * Set this to false to do an "initial import" of all your read files. */ onlyUnread: true }, kURLParser: /https?:\/\/[^\s'"><]+/gi, strategies: [ // youtube embed { kMatcher: /youtube.com\/embed\/([^?]+)/, canHandle(url) { return url.match(this.kMatcher); }, handle(url) { return 'youtube_embed:' + url.match(this.kMatcher)[1]; } }, // youtube video { kMatcher: /youtube.com\/watch.*v=([^&]+)/, canHandle(url) { return url.match(this.kMatcher); }, handle(url) { return 'youtube_video:' + url.match(this.kMatcher)[1]; } }, // youtube playlist { kMatcher: /youtube.com\/playlist.*list=([^&]+)/, canHandle(url) { return url.match(this.kMatcher); }, handle(url) { return 'youtube_playlist:' + url.match(this.kMatcher)[1]; } }, // youtube unmatched { canHandle(url) { return url.match(/youtube/); }, handle(url) { return '!!!!!!!!!!!!!!!!!:' + url } }, // bandcamp embedded track { kMatcher: /bandcamp.*EmbeddedPlayer.*track=([0-9]+)/, canHandle(url) { return url.match(this.kMatcher); }, handle(url) { return 'bc_embed_track:' + url.match(this.kMatcher)[1]; } }, // bandcamp embedded album { kMatcher: /bandcamp.*EmbeddedPlayer.*album=([0-9]+)/, canHandle(url) { return url.match(this.kMatcher); }, handle(url) { return 'bc_embed_album:' + url.match(this.kMatcher)[1]; } }, // bandcamp album { canHandle(url) { return url.match(/https?:\/\/([^.]+)\.bandcamp\.com\/album/); }, handle(url) { return 'bc_album:' + url } }, // bandcamp album { canHandle(url) { return url.match(/https?:\/\/([^.]+)\.bandcamp\.com\/track/); }, handle(url) { return 'bc_track:' + url } }, // bandcamp artist { kMatcher: /https?:\/\/([^.]+)\.bandcamp.com(?:\/music)?/, canHandle(url) { return url.match(this.kMatcher); }, handle(url) { return 'bc_artist:' + url.match(this.kMatcher)[1]; } }, // bandcamp unmatched { canHandle(url) { return url.match(/bandcamp\.com/); }, handle(url) { return '!!!!!!!!!!!!!!!!!:' + url } }, // soundcloud player { kMatcher: /soundcloud.com\/player.*tracks%2F([^&]+)/, canHandle(url) { return url.match(this.kMatcher); }, handle(url) { return 'sc_player: ' + url.match(this.kMatcher)[1] } }, // soundcloud track { kMatcher: /soundcloud.com\/([^\/]+)\/([^\/]+)/, canHandle(url) { return url.match(this.kMatcher); }, handle(url) { return 'soundcloud_track: ' + url.match(this.kMatcher)[2] } }, // soundcloud unmatched { canHandle(url) { return url.match(/soundcloud/); }, handle(url) { return '!!!!!!!!!!!!!!!!!:' + url } }, // spotify embed { kMatcher: /spotify.com\/embed\/track\/([^?]+)/, canHandle(url) { return url.match(this.kMatcher); }, handle(url) { return 'sp_embed:' + url.match(this.kMatcher)[1]; } }, // spotify unmatched { canHandle(url) { return url.match(/spotify/); }, handle(url) { return '!!!!!!!!!!!!!!!!!:' + url } }, ], extractURLsFromFeeds() { const app = Application("NetNewsWire"); app.includeStandardAdditions = true; let account = app.accounts.whose({name: internals.config.account})[0]; let musicFolder = account.folders.whose({name: internals.config.musicFolder})[0]; const feeds = musicFolder.webfeeds(); const urls = []; for (const feed of feeds) { const articles = feed.articles() .filter((article) => internals.config.onlyUnread ? !article.read : true); for (const article of articles) { console.log(article.title()) const html = article.html(); const extractedURLs = html.match(internals.kURLParser) || []; article.read = true urls.push(...extractedURLs) } } return urls; }, extractSongsFromURLs(urls) { let songs = []; for (url of urls) { for (const strategy of internals.strategies) { if (strategy.canHandle(url)) { songs.push(strategy.handle(url)) break; } } } return songs; } }; const run = function () { const urls = internals.extractURLsFromFeeds(); const songs = internals.extractSongsFromURLs(urls); return songs; } run(); zjscr úÞÞ­