Update database/update.js

This commit is contained in:
Aleksandr Statciuk 2022-02-13 05:30:31 +03:00
parent b3132150d7
commit 4a0666122d
2 changed files with 6 additions and 2 deletions

View File

@ -134,7 +134,11 @@ function findOrigin(requests = [], origins = {}) {
function parseStreams(streams) {
streams = streams.filter(s => s.codec_type === 'video')
streams = _.orderBy(streams, ['height', 'tags.variant_bitrate'], ['desc', 'desc'])
streams = _.orderBy(
streams,
['height', s => (s.tags.variant_bitrate ? parseInt(s.tags.variant_bitrate) : 0)],
['desc', 'desc']
)
const data = _.head(streams)
if (data) {

View File

@ -2,5 +2,5 @@
{"_id":"I6cjG2xCBRFFP4sz","error":"No streams found","streams":[],"requests":[]}
{"_id":"3TbieV1ptnZVCIdn","error":"Server returned 403 Forbidden (access denied)","streams":[],"requests":[]}
{"_id":"cFFpFVzSn6xFMUF3","error":"Server returned 404 Not Found","streams":[],"requests":[]}
{"_id":"u7iyA6cjtf1iWWAZ","error":null,"streams":[{"index":0,"codec_name":"timed_id3","codec_long_name":"timed ID3 metadata","codec_type":"data","codec_tag_string":"ID3 ","codec_tag":"0x20334449","r_frame_rate":"0/0","avg_frame_rate":"0/0","time_base":"1/90000","disposition":{"default":0,"dub":0,"original":0,"comment":0,"lyrics":0,"karaoke":0,"forced":0,"hearing_impaired":0,"visual_impaired":0,"clean_effects":0,"attached_pic":0,"timed_thumbnails":0},"tags":{"variant_bitrate":"1226543"}},{"index":1,"codec_name":"h264","codec_long_name":"H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10","profile":"Constrained Baseline","codec_type":"video","codec_tag_string":"[27][0][0][0]","codec_tag":"0x001b","width":1280,"height":720,"coded_width":1280,"coded_height":720,"closed_captions":0,"has_b_frames":3,"sample_aspect_ratio":"1:1","display_aspect_ratio":"16:9","pix_fmt":"yuv420p","level":31,"color_range":"tv","chroma_location":"left","refs":1,"is_avc":"false","nal_length_size":"0","r_frame_rate":"25/1","avg_frame_rate":"25/1","time_base":"1/90000","start_pts":5612807216,"start_time":"62364.524622","bits_per_raw_sample":"8","disposition":{"default":0,"dub":0,"original":0,"comment":0,"lyrics":0,"karaoke":0,"forced":0,"hearing_impaired":0,"visual_impaired":0,"clean_effects":0,"attached_pic":0,"timed_thumbnails":0},"tags":{"variant_bitrate":"1226543"}},{"index":2,"codec_name":"aac","codec_long_name":"AAC (Advanced Audio Coding)","profile":"LC","codec_type":"audio","codec_tag_string":"[15][0][0][0]","codec_tag":"0x000f","sample_fmt":"fltp","sample_rate":"48000","channels":2,"channel_layout":"stereo","bits_per_sample":0,"r_frame_rate":"0/0","avg_frame_rate":"0/0","time_base":"1/90000","start_pts":5612806046,"start_time":"62364.511622","disposition":{"default":0,"dub":0,"original":0,"comment":0,"lyrics":0,"karaoke":0,"forced":0,"hearing_impaired":0,"visual_impaired":0,"clean_effects":0,"attached_pic":0,"timed_thumbnails":0},"tags":{"variant_bitrate":"1226543"}},{"index":3,"codec_name":"h264","codec_long_name":"H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10","profile":"Constrained Baseline","codec_type":"video","codec_tag_string":"[27][0][0][0]","codec_tag":"0x001b","width":1280,"height":720,"coded_width":1280,"coded_height":720,"closed_captions":0,"has_b_frames":3,"sample_aspect_ratio":"1:1","display_aspect_ratio":"16:9","pix_fmt":"yuv420p","level":31,"color_range":"tv","chroma_location":"left","refs":1,"is_avc":"false","nal_length_size":"0","r_frame_rate":"25/1","avg_frame_rate":"25/1","time_base":"1/90000","start_pts":5612807216,"start_time":"62364.524622","bits_per_raw_sample":"8","disposition":{"default":0,"dub":0,"original":0,"comment":0,"lyrics":0,"karaoke":0,"forced":0,"hearing_impaired":0,"visual_impaired":0,"clean_effects":0,"attached_pic":0,"timed_thumbnails":0},"tags":{"variant_bitrate":"2226543"}}],"requests":[{"method":"GET","url":"https://forerunnerrtmp.livestreamingcdn.com/output18/output18.stream/playlist.m3u8","headers":{"User-Agent":"Lavf/58.76.100","Accept":"*/*","Range":"bytes=0-","Connection":"close","Host":"forerunnerrtmp.livestreamingcdn.com","Icy-MetaData":"1"}},{"method":"GET","url":"https://forerunnerrtmp.livestreamingcdn.com/output18/output18.stream/chunklist_w2083911960.m3u8","headers":{"User-Agent":"Lavf/58.76.100","Accept":"*/*","Range":"bytes=0-","Connection":"keep-alive","Host":"forerunnerrtmp.livestreamingcdn.com","Icy-MetaData":"1"}},{"method":"GET","url":"https://forerunnerrtmp.livestreamingcdn.com/output18/output18.stream/media_w2083911960_25312.ts","headers":{"User-Agent":"Lavf/58.76.100","Accept":"*/*","Range":"bytes=0-","Connection":"keep-alive","Host":"forerunnerrtmp.livestreamingcdn.com","Icy-MetaData":"1"}},{"method":"GET","url":"https://forerunnerrtmp.livestreamingcdn.com/output18/output18.stream/media_w2083911960_25313.ts","headers":{"User-Agent":"Lavf/58.76.100","Accept":"*/*","Range":"bytes=0-","Connection":"keep-alive","Host":"forerunnerrtmp.livestreamingcdn.com","Icy-MetaData":"1"}}]}
{"_id":"u7iyA6cjtf1iWWAZ","error":null,"streams":[{"index":0,"codec_name":"timed_id3","codec_long_name":"timed ID3 metadata","codec_type":"data","codec_tag_string":"ID3 ","codec_tag":"0x20334449","r_frame_rate":"0/0","avg_frame_rate":"0/0","time_base":"1/90000","disposition":{"default":0,"dub":0,"original":0,"comment":0,"lyrics":0,"karaoke":0,"forced":0,"hearing_impaired":0,"visual_impaired":0,"clean_effects":0,"attached_pic":0,"timed_thumbnails":0},"tags":{"variant_bitrate":"1226543"}},{"index":1,"codec_name":"h264","codec_long_name":"H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10","profile":"Constrained Baseline","codec_type":"video","codec_tag_string":"[27][0][0][0]","codec_tag":"0x001b","width":1280,"height":720,"coded_width":1280,"coded_height":720,"closed_captions":0,"has_b_frames":3,"sample_aspect_ratio":"1:1","display_aspect_ratio":"16:9","pix_fmt":"yuv420p","level":31,"color_range":"tv","chroma_location":"left","refs":1,"is_avc":"false","nal_length_size":"0","r_frame_rate":"25/1","avg_frame_rate":"25/1","time_base":"1/90000","start_pts":5612807216,"start_time":"62364.524622","bits_per_raw_sample":"8","disposition":{"default":0,"dub":0,"original":0,"comment":0,"lyrics":0,"karaoke":0,"forced":0,"hearing_impaired":0,"visual_impaired":0,"clean_effects":0,"attached_pic":0,"timed_thumbnails":0},"tags":{"variant_bitrate":"726543"}},{"index":2,"codec_name":"aac","codec_long_name":"AAC (Advanced Audio Coding)","profile":"LC","codec_type":"audio","codec_tag_string":"[15][0][0][0]","codec_tag":"0x000f","sample_fmt":"fltp","sample_rate":"48000","channels":2,"channel_layout":"stereo","bits_per_sample":0,"r_frame_rate":"0/0","avg_frame_rate":"0/0","time_base":"1/90000","start_pts":5612806046,"start_time":"62364.511622","disposition":{"default":0,"dub":0,"original":0,"comment":0,"lyrics":0,"karaoke":0,"forced":0,"hearing_impaired":0,"visual_impaired":0,"clean_effects":0,"attached_pic":0,"timed_thumbnails":0},"tags":{"variant_bitrate":"1226543"}},{"index":3,"codec_name":"h264","codec_long_name":"H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10","profile":"Constrained Baseline","codec_type":"video","codec_tag_string":"[27][0][0][0]","codec_tag":"0x001b","width":1280,"height":720,"coded_width":1280,"coded_height":720,"closed_captions":0,"has_b_frames":3,"sample_aspect_ratio":"1:1","display_aspect_ratio":"16:9","pix_fmt":"yuv420p","level":31,"color_range":"tv","chroma_location":"left","refs":1,"is_avc":"false","nal_length_size":"0","r_frame_rate":"25/1","avg_frame_rate":"25/1","time_base":"1/90000","start_pts":5612807216,"start_time":"62364.524622","bits_per_raw_sample":"8","disposition":{"default":0,"dub":0,"original":0,"comment":0,"lyrics":0,"karaoke":0,"forced":0,"hearing_impaired":0,"visual_impaired":0,"clean_effects":0,"attached_pic":0,"timed_thumbnails":0},"tags":{"variant_bitrate":"2226543"}}],"requests":[{"method":"GET","url":"https://forerunnerrtmp.livestreamingcdn.com/output18/output18.stream/playlist.m3u8","headers":{"User-Agent":"Lavf/58.76.100","Accept":"*/*","Range":"bytes=0-","Connection":"close","Host":"forerunnerrtmp.livestreamingcdn.com","Icy-MetaData":"1"}},{"method":"GET","url":"https://forerunnerrtmp.livestreamingcdn.com/output18/output18.stream/chunklist_w2083911960.m3u8","headers":{"User-Agent":"Lavf/58.76.100","Accept":"*/*","Range":"bytes=0-","Connection":"keep-alive","Host":"forerunnerrtmp.livestreamingcdn.com","Icy-MetaData":"1"}},{"method":"GET","url":"https://forerunnerrtmp.livestreamingcdn.com/output18/output18.stream/media_w2083911960_25312.ts","headers":{"User-Agent":"Lavf/58.76.100","Accept":"*/*","Range":"bytes=0-","Connection":"keep-alive","Host":"forerunnerrtmp.livestreamingcdn.com","Icy-MetaData":"1"}},{"method":"GET","url":"https://forerunnerrtmp.livestreamingcdn.com/output18/output18.stream/media_w2083911960_25313.ts","headers":{"User-Agent":"Lavf/58.76.100","Accept":"*/*","Range":"bytes=0-","Connection":"keep-alive","Host":"forerunnerrtmp.livestreamingcdn.com","Icy-MetaData":"1"}}]}
{"_id":"WTbieV1ptnZVCIdn","error":null,"streams":[{"index":0,"codec_name":"h264","codec_long_name":"H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10","profile":"Baseline","codec_type":"video","codec_tag_string":"[27][0][0][0]","codec_tag":"0x001b","width":1024,"height":576,"coded_width":1024,"coded_height":576,"closed_captions":0,"has_b_frames":0,"sample_aspect_ratio":"1:1","display_aspect_ratio":"16:9","pix_fmt":"yuv420p","level":31,"color_range":"tv","color_space":"bt709","color_transfer":"bt709","color_primaries":"bt709","chroma_location":"left","refs":1,"is_avc":"false","nal_length_size":"0","r_frame_rate":"25/1","avg_frame_rate":"25/1","time_base":"1/90000","start_pts":7878865078,"start_time":"87542.945311","bits_per_raw_sample":"8","disposition":{"default":0,"dub":0,"original":0,"comment":0,"lyrics":0,"karaoke":0,"forced":0,"hearing_impaired":0,"visual_impaired":0,"clean_effects":0,"attached_pic":0,"timed_thumbnails":0},"tags":{"variant_bitrate":"0"}},{"index":1,"codec_name":"aac","codec_long_name":"AAC (Advanced Audio Coding)","profile":"HE-AAC","codec_type":"audio","codec_tag_string":"[15][0][0][0]","codec_tag":"0x000f","sample_fmt":"fltp","sample_rate":"48000","channels":2,"channel_layout":"stereo","bits_per_sample":0,"r_frame_rate":"0/0","avg_frame_rate":"0/0","time_base":"1/90000","start_pts":7878863698,"start_time":"87542.929978","disposition":{"default":0,"dub":0,"original":0,"comment":0,"lyrics":0,"karaoke":0,"forced":0,"hearing_impaired":0,"visual_impaired":0,"clean_effects":0,"attached_pic":0,"timed_thumbnails":0},"tags":{"variant_bitrate":"0"}}],"requests":[{"method":"GET","url":"https://master.starmena-cloud.com/hls/libyas.m3u8","headers":{"User-Agent":"Lavf/58.76.100","Accept":"*/*","Range":"bytes=0-","Connection":"close","Host":"master.starmena-cloud.com","Icy-MetaData":"1"}},{"method":"GET","url":"https://master.starmena-cloud.com/hls/libyas-432343.ts","headers":{"User-Agent":"Lavf/58.76.100","Accept":"*/*","Range":"bytes=0-","Connection":"keep-alive","Host":"master.starmena-cloud.com","Icy-MetaData":"1"}},{"method":"GET","url":"https://master.starmena-cloud.com/hls/libyas-432344.ts","headers":{"User-Agent":"Lavf/58.76.100","Accept":"*/*","Range":"bytes=0-","Connection":"keep-alive","Host":"master.starmena-cloud.com","Icy-MetaData":"1"}}]}