Update format.js
- check if the channel already has the resolution specified - small refactoring
This commit is contained in:
		| @@ -118,13 +118,13 @@ async function detectResolution(playlist) { | |||||||
|   const results = [] |   const results = [] | ||||||
|   for (const channel of playlist.channels) { |   for (const channel of playlist.channels) { | ||||||
|     bar.tick() |     bar.tick() | ||||||
|     const url = channel.url |     if (!channel.resolution.height) { | ||||||
|       const response = await instance |       const response = await instance | ||||||
|       .get(url) |         .get(channel.url) | ||||||
|         .then(utils.sleep(config.delay)) |         .then(utils.sleep(config.delay)) | ||||||
|         .catch(err => {}) |         .catch(err => {}) | ||||||
|     if (response) { |  | ||||||
|       if (response.status === 200) { |       if (response && response.status === 200) { | ||||||
|         if (/^#EXTM3U/.test(response.data)) { |         if (/^#EXTM3U/.test(response.data)) { | ||||||
|           const resolution = parseResolution(response.data) |           const resolution = parseResolution(response.data) | ||||||
|           if (resolution) { |           if (resolution) { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user