Merge branch 'master' into faq-patch

This commit is contained in:
Diego 2022-08-13 17:57:18 -05:00 committed by GitHub
commit 56e49d49a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 10 deletions

View File

@ -13,7 +13,7 @@ async function main() {
let streams = await db.streams.find({}) let streams = await db.streams.find({})
streams = _.sortBy(streams, 'channel') streams = _.sortBy(streams, 'channel')
streams = streams.map(stream => { streams = streams.map(stream => {
const data = { let data = {
channel: stream.channel, channel: stream.channel,
url: stream.url, url: stream.url,
http_referrer: stream.http_referrer, http_referrer: stream.http_referrer,
@ -29,6 +29,7 @@ async function main() {
let updatedAt = now let updatedAt = now
let found = api.streams.find({ url: stream.url }) let found = api.streams.find({ url: stream.url })
if (found) { if (found) {
data = JSON.parse(JSON.stringify(data))
normalized = _.omit(found, ['added_at', 'updated_at', 'checked_at']) normalized = _.omit(found, ['added_at', 'updated_at', 'checked_at'])
if (_.isEqual(data, normalized)) { if (_.isEqual(data, normalized)) {
addedAt = found.added_at || now addedAt = found.added_at || now

View File

@ -443,6 +443,8 @@ https://live.obslivestream.com/vztv/index.m3u8
http://free.fullspeed.tv/iptv-query?streaming-ip=https://www.dailymotion.com/WillaxTV http://free.fullspeed.tv/iptv-query?streaming-ip=https://www.dailymotion.com/WillaxTV
#EXTINF:-1 tvg-id="Wtv.pe" status="error",Wtv (Bambamarca) (480p) [Not 24/7] #EXTINF:-1 tvg-id="Wtv.pe" status="error",Wtv (Bambamarca) (480p) [Not 24/7]
https://tv.inka.net.pe/wtv/wtv/index.m3u8 https://tv.inka.net.pe/wtv/wtv/index.m3u8
#EXTINF:-1 tvg-id="CongresoTV.pe" status="online",Congreso TV [Not 24/7]
http://free.fullspeed.tv/iptv-query?streaming-ip=https://www.youtube.com/c/CongresodelaRep%C3%BAblicadelPer%C3%BATVenvivo/live
#EXTINF:-1 tvg-id="XTVChachapoyas.pe" status="online",X TV (Chachapoyas) (720p) [Not 24/7] #EXTINF:-1 tvg-id="XTVChachapoyas.pe" status="online",X TV (Chachapoyas) (720p) [Not 24/7]
https://tv.oyotunstream.com:1936/xtv/xtv/playlist.m3u8 https://tv.oyotunstream.com:1936/xtv/xtv/playlist.m3u8
#EXTINF:-1 tvg-id="" status="blocked",MX Old #EXTINF:-1 tvg-id="" status="blocked",MX Old

View File

@ -1 +1 @@
[{"channel":"LDPRTV.ru","url":"http://46.46.143.222:1935/live/mp4:ldpr.stream/playlist.m3u8","http_referrer":null,"user_agent":null,"status":"online","width":1920,"height":1080,"bitrate":6542556,"frame_rate":50,"added_at":"2022-07-07T00:00:00Z","checked_at":"2022-08-07T00:00:00Z","updated_at":"2022-08-07T00:00:00Z"},{"channel":"LibyasChannel.ly","url":"https://master.starmena-cloud.com/hls/libyas.m3u8","http_referrer":null,"user_agent":null,"status":"online","width":1024,"height":576,"bitrate":0,"frame_rate":25,"added_at":"2022-07-07T00:00:00Z","checked_at":"2022-07-07T00:00:00Z","updated_at":"2022-07-07T00:00:00Z"}] [{"channel":"AndorraTV.ad","url":"https://iptv-all.lanesh4d0w.repl.co/andorra/atv","http_referrer":"http://imn.iq","user_agent":"Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148","status":"error","added_at":"2022-07-07T00:00:00Z","updated_at":"2022-08-07T00:00:00Z","checked_at":"2022-08-07T00:00:00Z"},{"channel":"LDPRTV.ru","url":"http://46.46.143.222:1935/live/mp4:ldpr.stream/playlist.m3u8","http_referrer":null,"user_agent":null,"status":"online","width":1920,"height":1080,"bitrate":6542556,"frame_rate":50,"added_at":"2022-07-07T00:00:00Z","checked_at":"2022-08-07T00:00:00Z","updated_at":"2022-08-07T00:00:00Z"},{"channel":"LibyasChannel.ly","url":"https://master.starmena-cloud.com/hls/libyas.m3u8","http_referrer":null,"user_agent":null,"status":"online","width":1024,"height":576,"bitrate":0,"frame_rate":25,"added_at":"2022-07-07T00:00:00Z","checked_at":"2022-07-07T00:00:00Z","updated_at":"2022-07-07T00:00:00Z"}]

View File

@ -21,22 +21,34 @@ it('can create streams.json', () => {
let output = content(`output/.api/streams.json`) let output = content(`output/.api/streams.json`)
let expected = content(`expected/.api/streams.json`) let expected = content(`expected/.api/streams.json`)
const updatedUrl = 'https://master.starmena-cloud.com/hls/libyas.m3u8' const samples = {
let outputData = output.find(i => i.url === updatedUrl) unchanged_online: 'https://master.starmena-cloud.com/hls/libyas.m3u8',
let savedData = api.find(i => i.url === updatedUrl) unchanged_error: 'https://iptv-all.lanesh4d0w.repl.co/andorra/atv',
updated_error: 'http://46.46.143.222:1935/live/mp4:ldpr.stream/playlist.m3u8',
added_online: 'https://master.starmena-cloud.com/hls/bbc.m3u8'
}
let outputData, savedData
outputData = output.find(i => i.url === samples['unchanged_online'])
savedData = api.find(i => i.url === samples['unchanged_online'])
expect(outputData.added_at).toBe(savedData.added_at) expect(outputData.added_at).toBe(savedData.added_at)
expect(outputData.updated_at).toBe(savedData.updated_at) expect(outputData.updated_at).toBe(savedData.updated_at)
expect(dayjs().diff(outputData.checked_at, 'h')).toBe(0) expect(dayjs().diff(outputData.checked_at, 'h')).toBe(0)
const sameUrl = 'http://46.46.143.222:1935/live/mp4:ldpr.stream/playlist.m3u8' outputData = output.find(i => i.url === samples['unchanged_error'])
outputData = output.find(i => i.url === sameUrl) savedData = api.find(i => i.url === samples['unchanged_error'])
savedData = api.find(i => i.url === sameUrl) expect(outputData.added_at).toBe(savedData.added_at)
expect(outputData.updated_at).toBe(savedData.updated_at)
expect(dayjs().diff(outputData.checked_at, 'h')).toBe(0)
outputData = output.find(i => i.url === samples['updated_error'])
savedData = api.find(i => i.url === samples['unchanged_error'])
expect(outputData.added_at).toBe(savedData.added_at) expect(outputData.added_at).toBe(savedData.added_at)
expect(dayjs().diff(outputData.updated_at, 'h')).toBe(0) expect(dayjs().diff(outputData.updated_at, 'h')).toBe(0)
expect(dayjs().diff(outputData.checked_at, 'h')).toBe(0) expect(dayjs().diff(outputData.checked_at, 'h')).toBe(0)
const addedUrl = 'https://master.starmena-cloud.com/hls/bbc.m3u8' outputData = output.find(i => i.url === samples['added_online'])
outputData = output.find(i => i.url === addedUrl)
expect(dayjs().diff(outputData.added_at, 'h')).toBe(0) expect(dayjs().diff(outputData.added_at, 'h')).toBe(0)
expect(dayjs().diff(outputData.updated_at, 'h')).toBe(0) expect(dayjs().diff(outputData.updated_at, 'h')).toBe(0)
expect(dayjs().diff(outputData.checked_at, 'h')).toBe(0) expect(dayjs().diff(outputData.checked_at, 'h')).toBe(0)