mirror of https://github.com/iptv-org/iptv
commit
0cc9d92254
@ -1,163 +0,0 @@
|
|||||||
name: auto-update
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
schedule:
|
|
||||||
- cron: '0 0,12 * * *'
|
|
||||||
jobs:
|
|
||||||
setup:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- uses: actions/setup-node@v3
|
|
||||||
if: ${{ !env.ACT }}
|
|
||||||
with:
|
|
||||||
node-version: 16
|
|
||||||
cache: 'npm'
|
|
||||||
- run: npm run api:load
|
|
||||||
- uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: data
|
|
||||||
path: scripts/data
|
|
||||||
- run: npm install
|
|
||||||
- run: npm run db:create
|
|
||||||
- uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: database
|
|
||||||
path: scripts/database
|
|
||||||
- run: npm run db:matrix --silent >> $GITHUB_OUTPUT
|
|
||||||
id: create-matrix
|
|
||||||
outputs:
|
|
||||||
matrix: ${{ steps.create-matrix.outputs.MATRIX }}
|
|
||||||
load:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: setup
|
|
||||||
continue-on-error: true
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix: ${{ fromJson(needs.setup.outputs.MATRIX) }}
|
|
||||||
# matrix:
|
|
||||||
# cluster_id: [1]
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- name: Install ffmpeg
|
|
||||||
run: |
|
|
||||||
sudo rm -rf /var/lib/apt/lists/*
|
|
||||||
sudo apt-get clean
|
|
||||||
sudo apt-get update -y
|
|
||||||
sudo apt-get install -y ffmpeg
|
|
||||||
ffmpeg -version
|
|
||||||
ffprobe -version
|
|
||||||
- uses: actions/setup-node@v3
|
|
||||||
if: ${{ !env.ACT }}
|
|
||||||
with:
|
|
||||||
node-version: 16
|
|
||||||
- uses: actions/download-artifact@v3
|
|
||||||
with:
|
|
||||||
name: database
|
|
||||||
path: scripts/database
|
|
||||||
- run: npm install
|
|
||||||
- run: npm run cluster:load -- --cluster-id=${{ matrix.cluster_id }}
|
|
||||||
- uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: logs
|
|
||||||
path: scripts/logs
|
|
||||||
update:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: load
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
- run: echo "BRANCH_NAME=$(date +'bot/auto-update-%s')" >> $GITHUB_OUTPUT
|
|
||||||
id: create-branch-name
|
|
||||||
- run: git config user.name 'iptv-bot[bot]'
|
|
||||||
- run: git config user.email '84861620+iptv-bot[bot]@users.noreply.github.com'
|
|
||||||
- run: git checkout -b ${{ steps.create-branch-name.outputs.BRANCH_NAME }}
|
|
||||||
- uses: tibdex/github-app-token@v1
|
|
||||||
if: ${{ !env.ACT }}
|
|
||||||
id: create-app-token
|
|
||||||
with:
|
|
||||||
app_id: ${{ secrets.APP_ID }}
|
|
||||||
private_key: ${{ secrets.APP_PRIVATE_KEY }}
|
|
||||||
- uses: actions/setup-node@v3
|
|
||||||
if: ${{ !env.ACT }}
|
|
||||||
with:
|
|
||||||
node-version: 16
|
|
||||||
- uses: actions/download-artifact@v3
|
|
||||||
with:
|
|
||||||
name: data
|
|
||||||
path: scripts/data
|
|
||||||
- uses: actions/download-artifact@v3
|
|
||||||
with:
|
|
||||||
name: database
|
|
||||||
path: scripts/database
|
|
||||||
- uses: actions/download-artifact@v3
|
|
||||||
with:
|
|
||||||
name: logs
|
|
||||||
path: scripts/logs
|
|
||||||
- run: npm install
|
|
||||||
- run: npm run db:update
|
|
||||||
- run: npm run db:clear
|
|
||||||
- run: npm run db:export
|
|
||||||
- uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: api
|
|
||||||
path: .api
|
|
||||||
- run: npm run playlist:update
|
|
||||||
- run: npm run playlist:generate
|
|
||||||
- uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: logs
|
|
||||||
path: scripts/logs
|
|
||||||
- run: npm run readme:update
|
|
||||||
- name: Commit Changes
|
|
||||||
if: ${{ !env.ACT }}
|
|
||||||
run: |
|
|
||||||
git add streams/*
|
|
||||||
git commit -m "[Bot] Update /streams"
|
|
||||||
git add README.md
|
|
||||||
git commit -m "[Bot] Update README.md"
|
|
||||||
git status
|
|
||||||
git push -u origin ${{ steps.create-branch-name.outputs.BRANCH_NAME }}
|
|
||||||
- name: Deploy to gh-pages
|
|
||||||
uses: JamesIves/github-pages-deploy-action@v4.4.1
|
|
||||||
if: ${{ !env.ACT && github.ref == 'refs/heads/master' }}
|
|
||||||
with:
|
|
||||||
branch: gh-pages
|
|
||||||
folder: .gh-pages
|
|
||||||
token: ${{ steps.create-app-token.outputs.token }}
|
|
||||||
git-config-name: iptv-bot[bot]
|
|
||||||
git-config-email: 84861620+iptv-bot[bot]@users.noreply.github.com
|
|
||||||
commit-message: '[Bot] Deploy to GitHub Pages'
|
|
||||||
single-commit: true
|
|
||||||
clean: true
|
|
||||||
- name: Deploy to iptv-org/api
|
|
||||||
uses: JamesIves/github-pages-deploy-action@v4.4.1
|
|
||||||
if: ${{ !env.ACT && github.ref == 'refs/heads/master' }}
|
|
||||||
with:
|
|
||||||
repository-name: iptv-org/api
|
|
||||||
branch: gh-pages
|
|
||||||
folder: .api
|
|
||||||
token: ${{ steps.create-app-token.outputs.token }}
|
|
||||||
git-config-name: iptv-bot[bot]
|
|
||||||
git-config-email: 84861620+iptv-bot[bot]@users.noreply.github.com
|
|
||||||
commit-message: '[Bot] Deploy to iptv-org/api'
|
|
||||||
clean: false
|
|
||||||
- uses: repo-sync/pull-request@v2.9
|
|
||||||
if: ${{ !env.ACT && github.ref == 'refs/heads/master' }}
|
|
||||||
id: pull-request
|
|
||||||
with:
|
|
||||||
github_token: ${{ steps.create-app-token.outputs.token }}
|
|
||||||
source_branch: ${{ steps.create-branch-name.outputs.BRANCH_NAME }}
|
|
||||||
destination_branch: 'master'
|
|
||||||
pr_title: '[Bot] Daily update'
|
|
||||||
pr_body: |
|
|
||||||
This pull request is created by [auto-update][1] workflow.
|
|
||||||
|
|
||||||
[1]: https://github.com/iptv-org/iptv/actions/runs/${{ github.run_id }}
|
|
||||||
- uses: juliangruber/merge-pull-request-action@v1
|
|
||||||
if: ${{ !env.ACT && github.ref == 'refs/heads/master' }}
|
|
||||||
with:
|
|
||||||
github-token: ${{ secrets.PAT }}
|
|
||||||
number: ${{ steps.pull-request.outputs.pr_number }}
|
|
||||||
method: squash
|
|
@ -1,36 +0,0 @@
|
|||||||
name: check
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
pull_request:
|
|
||||||
types: [opened, synchronize, reopened, edited]
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
jobs:
|
|
||||||
check:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
fetch-depth: 2
|
|
||||||
- uses: tj-actions/changed-files@v35
|
|
||||||
id: files
|
|
||||||
with:
|
|
||||||
files: streams/*.m3u
|
|
||||||
- uses: actions/setup-node@v3
|
|
||||||
if: ${{ !env.ACT && steps.files.outputs.any_changed == 'true' }}
|
|
||||||
with:
|
|
||||||
node-version: 16
|
|
||||||
cache: 'npm'
|
|
||||||
- name: download data from api
|
|
||||||
if: steps.files.outputs.any_changed == 'true'
|
|
||||||
run: |
|
|
||||||
mkdir -p scripts/data
|
|
||||||
curl -L -o scripts/data/blocklist.json https://iptv-org.github.io/api/blocklist.json
|
|
||||||
curl -L -o scripts/data/channels.json https://iptv-org.github.io/api/channels.json
|
|
||||||
- name: validate
|
|
||||||
if: steps.files.outputs.any_changed == 'true'
|
|
||||||
run: |
|
|
||||||
npm install
|
|
||||||
npm run playlist:lint -- ${{ steps.files.outputs.all_changed_files }}
|
|
||||||
npm run playlist:validate -- ${{ steps.files.outputs.all_changed_files }}
|
|
@ -1,9 +0,0 @@
|
|||||||
name: test
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
jobs:
|
|
||||||
main:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- run: echo "Hello World"
|
|
@ -0,0 +1,28 @@
|
|||||||
|
const { logger, db, file } = require('../../core')
|
||||||
|
const _ = require('lodash')
|
||||||
|
|
||||||
|
const PUBLIC_DIR = process.env.PUBLIC_DIR || '.api'
|
||||||
|
|
||||||
|
async function main() {
|
||||||
|
logger.info(`loading streams...`)
|
||||||
|
await db.streams.load()
|
||||||
|
|
||||||
|
let streams = await db.streams.find({})
|
||||||
|
streams = _.sortBy(streams, 'channel')
|
||||||
|
streams = streams.map(stream => {
|
||||||
|
let data = {
|
||||||
|
channel: stream.channel,
|
||||||
|
url: stream.url,
|
||||||
|
http_referrer: stream.http_referrer,
|
||||||
|
user_agent: stream.user_agent
|
||||||
|
}
|
||||||
|
|
||||||
|
return data
|
||||||
|
})
|
||||||
|
logger.info(`found ${streams.length} streams`)
|
||||||
|
|
||||||
|
logger.info('saving to .api/streams.json...')
|
||||||
|
await file.create(`${PUBLIC_DIR}/streams.json`, JSON.stringify(streams))
|
||||||
|
}
|
||||||
|
|
||||||
|
main()
|
@ -1,65 +0,0 @@
|
|||||||
const { db, logger, timer, checker, store, file, parser } = require('../../core')
|
|
||||||
const { program } = require('commander')
|
|
||||||
|
|
||||||
const options = program
|
|
||||||
.requiredOption('-c, --cluster-id <cluster-id>', 'The ID of cluster to load', parser.parseNumber)
|
|
||||||
.option('-t, --timeout <timeout>', 'Set timeout for each request', parser.parseNumber, 60000)
|
|
||||||
.option('-d, --delay <delay>', 'Set delay for each request', parser.parseNumber, 0)
|
|
||||||
.option('--debug', 'Enable debug mode', false)
|
|
||||||
.parse(process.argv)
|
|
||||||
.opts()
|
|
||||||
|
|
||||||
const config = {
|
|
||||||
timeout: options.timeout,
|
|
||||||
delay: options.delay,
|
|
||||||
debug: options.debug
|
|
||||||
}
|
|
||||||
|
|
||||||
const LOGS_DIR = process.env.LOGS_DIR || 'scripts/logs/cluster/load'
|
|
||||||
|
|
||||||
async function main() {
|
|
||||||
logger.info('starting...')
|
|
||||||
logger.info(`timeout: ${options.timeout}ms`)
|
|
||||||
logger.info(`delay: ${options.delay}ms`)
|
|
||||||
timer.start()
|
|
||||||
|
|
||||||
const clusterLog = `${LOGS_DIR}/cluster_${options.clusterId}.log`
|
|
||||||
logger.info(`loading cluster: ${options.clusterId}`)
|
|
||||||
logger.info(`creating '${clusterLog}'...`)
|
|
||||||
await file.create(clusterLog)
|
|
||||||
await db.streams.load()
|
|
||||||
const items = await db.streams.find({ cluster_id: options.clusterId })
|
|
||||||
const total = items.length
|
|
||||||
logger.info(`found ${total} links`)
|
|
||||||
|
|
||||||
logger.info('checking...')
|
|
||||||
const results = {}
|
|
||||||
for (const [i, item] of items.entries()) {
|
|
||||||
const message = `[${i + 1}/${total}] ${item.filepath}: ${item.url}`
|
|
||||||
const request = {
|
|
||||||
_id: item._id,
|
|
||||||
url: item.url,
|
|
||||||
http: {
|
|
||||||
referrer: item.http_referrer,
|
|
||||||
'user-agent': item.user_agent
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const result = await checker.check(request, config)
|
|
||||||
if (!result.error) {
|
|
||||||
logger.info(message)
|
|
||||||
} else {
|
|
||||||
logger.info(`${message} (${result.error.message})`)
|
|
||||||
}
|
|
||||||
const output = {
|
|
||||||
_id: result._id,
|
|
||||||
error: result.error,
|
|
||||||
streams: result.streams,
|
|
||||||
requests: result.requests
|
|
||||||
}
|
|
||||||
await file.append(clusterLog, JSON.stringify(output) + '\n')
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.info(`done in ${timer.format('HH[h] mm[m] ss[s]')}`)
|
|
||||||
}
|
|
||||||
|
|
||||||
main()
|
|
@ -1,47 +0,0 @@
|
|||||||
const { logger, parser, db, date } = require('../../core')
|
|
||||||
const { program } = require('commander')
|
|
||||||
|
|
||||||
const options = program
|
|
||||||
.option(
|
|
||||||
'-t, --threshold <threshold>',
|
|
||||||
'Number of days after which the stream should be deleted',
|
|
||||||
parser.parseNumber,
|
|
||||||
7
|
|
||||||
)
|
|
||||||
.option('--input-dir <input-dir>', 'Set path to input directory', 'streams')
|
|
||||||
.parse(process.argv)
|
|
||||||
.opts()
|
|
||||||
|
|
||||||
async function main() {
|
|
||||||
await db.streams.load()
|
|
||||||
|
|
||||||
const streams = await db.streams.all()
|
|
||||||
|
|
||||||
let buffer = {}
|
|
||||||
let removed = 0
|
|
||||||
logger.info('searching...')
|
|
||||||
for (const stream of streams) {
|
|
||||||
if (
|
|
||||||
stream.status === 'error' &&
|
|
||||||
date.utc().diff(stream.updated_at, 'day') >= options.threshold
|
|
||||||
) {
|
|
||||||
logger.info(`${stream.url} (offline)`)
|
|
||||||
removed += await db.streams.remove({ url: stream.url }, { multi: true })
|
|
||||||
}
|
|
||||||
|
|
||||||
const key = stream.url.toLowerCase()
|
|
||||||
if (buffer[key]) {
|
|
||||||
logger.info(`${stream.url} (duplicate)`)
|
|
||||||
await db.streams.remove({ _id: stream._id })
|
|
||||||
removed++
|
|
||||||
} else {
|
|
||||||
buffer[key] = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
await db.streams.compact()
|
|
||||||
|
|
||||||
logger.info(`removed ${removed} streams`)
|
|
||||||
}
|
|
||||||
|
|
||||||
main()
|
|
@ -1,53 +0,0 @@
|
|||||||
const { logger, db, api, file } = require('../../core')
|
|
||||||
const _ = require('lodash')
|
|
||||||
const dayjs = require('dayjs')
|
|
||||||
const utc = require('dayjs/plugin/utc')
|
|
||||||
dayjs.extend(utc)
|
|
||||||
|
|
||||||
const PUBLIC_DIR = process.env.PUBLIC_DIR || '.api'
|
|
||||||
|
|
||||||
async function main() {
|
|
||||||
await api.streams.load()
|
|
||||||
await db.streams.load()
|
|
||||||
const now = dayjs.utc().format()
|
|
||||||
let streams = await db.streams.find({})
|
|
||||||
streams = _.sortBy(streams, 'channel')
|
|
||||||
streams = streams.map(stream => {
|
|
||||||
let data = {
|
|
||||||
channel: stream.channel,
|
|
||||||
url: stream.url,
|
|
||||||
http_referrer: stream.http_referrer,
|
|
||||||
user_agent: stream.user_agent,
|
|
||||||
status: stream.status,
|
|
||||||
width: stream.width,
|
|
||||||
height: stream.height,
|
|
||||||
bitrate: stream.bitrate,
|
|
||||||
frame_rate: stream.frame_rate
|
|
||||||
}
|
|
||||||
|
|
||||||
let addedAt = now
|
|
||||||
let updatedAt = now
|
|
||||||
let found = api.streams.find({ url: stream.url })
|
|
||||||
if (found) {
|
|
||||||
data = JSON.parse(JSON.stringify(data))
|
|
||||||
normalized = _.omit(found, ['added_at', 'updated_at', 'checked_at'])
|
|
||||||
if (_.isEqual(data, normalized)) {
|
|
||||||
addedAt = found.added_at || now
|
|
||||||
updatedAt = found.updated_at || now
|
|
||||||
} else {
|
|
||||||
addedAt = found.added_at || now
|
|
||||||
updatedAt = now
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
data.added_at = addedAt
|
|
||||||
data.updated_at = updatedAt
|
|
||||||
data.checked_at = now
|
|
||||||
|
|
||||||
return data
|
|
||||||
})
|
|
||||||
|
|
||||||
await file.create(`${PUBLIC_DIR}/streams.json`, JSON.stringify(streams))
|
|
||||||
}
|
|
||||||
|
|
||||||
main()
|
|
@ -1,16 +0,0 @@
|
|||||||
const { logger, db } = require('../../core')
|
|
||||||
|
|
||||||
async function main() {
|
|
||||||
await db.streams.load()
|
|
||||||
const docs = await db.streams.find({}).sort({ cluster_id: 1 })
|
|
||||||
const cluster_id = docs.reduce((acc, curr) => {
|
|
||||||
if (!acc.includes(curr.cluster_id)) acc.push(curr.cluster_id)
|
|
||||||
return acc
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
const matrix = { cluster_id }
|
|
||||||
const output = `MATRIX=${JSON.stringify(matrix)}`
|
|
||||||
logger.info(output)
|
|
||||||
}
|
|
||||||
|
|
||||||
main()
|
|
@ -1,161 +0,0 @@
|
|||||||
const { db, store, parser, file, logger } = require('../../core')
|
|
||||||
const _ = require('lodash')
|
|
||||||
const dayjs = require('dayjs')
|
|
||||||
const utc = require('dayjs/plugin/utc')
|
|
||||||
dayjs.extend(utc)
|
|
||||||
|
|
||||||
const LOGS_DIR = process.env.LOGS_DIR || 'scripts/logs/cluster/load'
|
|
||||||
|
|
||||||
async function main() {
|
|
||||||
const streams = await loadStreams()
|
|
||||||
const results = await loadResults()
|
|
||||||
const origins = await loadOrigins(results)
|
|
||||||
|
|
||||||
await updateStreams(streams, results, origins)
|
|
||||||
}
|
|
||||||
|
|
||||||
main()
|
|
||||||
|
|
||||||
async function updateStreams(items = [], results = {}, origins = {}) {
|
|
||||||
logger.info('updating streams...')
|
|
||||||
|
|
||||||
let updated = 0
|
|
||||||
const now = dayjs.utc().format()
|
|
||||||
for (const item of items) {
|
|
||||||
const stream = store.create(item)
|
|
||||||
const result = results[item._id]
|
|
||||||
if (result) {
|
|
||||||
const status = parseStatus(result.error)
|
|
||||||
if (status) {
|
|
||||||
stream.set('status', { status })
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result.streams.length) {
|
|
||||||
const { width, height, bitrate, frame_rate } = parseMediaInfo(result.streams)
|
|
||||||
stream.set('width', { width })
|
|
||||||
stream.set('height', { height })
|
|
||||||
stream.set('bitrate', { bitrate })
|
|
||||||
stream.set('frame_rate', { frame_rate })
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result.requests.length) {
|
|
||||||
const origin = findOrigin(result.requests, origins)
|
|
||||||
if (origin) {
|
|
||||||
stream.set('url', { url: origin })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stream.changed) {
|
|
||||||
stream.set('updated_at', { updated_at: now })
|
|
||||||
await db.streams.update({ _id: stream.get('_id') }, stream.data())
|
|
||||||
updated++
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
db.streams.compact()
|
|
||||||
|
|
||||||
logger.info(`updated ${updated} streams`)
|
|
||||||
logger.info('done')
|
|
||||||
}
|
|
||||||
|
|
||||||
async function loadStreams() {
|
|
||||||
logger.info('loading streams...')
|
|
||||||
|
|
||||||
await db.streams.load()
|
|
||||||
const streams = await db.streams.find({})
|
|
||||||
|
|
||||||
logger.info(`found ${streams.length} streams`)
|
|
||||||
|
|
||||||
return streams
|
|
||||||
}
|
|
||||||
|
|
||||||
async function loadResults() {
|
|
||||||
logger.info('loading check results...')
|
|
||||||
|
|
||||||
const results = {}
|
|
||||||
const files = await file.list(`${LOGS_DIR}/cluster_*.log`)
|
|
||||||
for (const filepath of files) {
|
|
||||||
const parsed = await parser.parseLogs(filepath)
|
|
||||||
for (const item of parsed) {
|
|
||||||
results[item._id] = item
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.info(`found ${Object.values(results).length} results`)
|
|
||||||
|
|
||||||
return results
|
|
||||||
}
|
|
||||||
|
|
||||||
async function loadOrigins(results = {}) {
|
|
||||||
logger.info('loading origins...')
|
|
||||||
|
|
||||||
const origins = {}
|
|
||||||
for (const { error, requests } of Object.values(results)) {
|
|
||||||
if (error || !Array.isArray(requests) || !requests.length) continue
|
|
||||||
|
|
||||||
let origin = requests.shift()
|
|
||||||
origin = new URL(origin.url)
|
|
||||||
for (const request of requests) {
|
|
||||||
const curr = new URL(request.url)
|
|
||||||
const key = curr.href.replace(/(^\w+:|^)/, '')
|
|
||||||
if (!origins[key] && curr.host === origin.host) {
|
|
||||||
origins[key] = origin.href
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.info(`found ${_.uniq(Object.values(origins)).length} origins`)
|
|
||||||
|
|
||||||
return origins
|
|
||||||
}
|
|
||||||
|
|
||||||
function findOrigin(requests = [], origins = {}) {
|
|
||||||
if (origins && Array.isArray(requests)) {
|
|
||||||
requests = requests.map(r => r.url.replace(/(^\w+:|^)/, ''))
|
|
||||||
for (const url of requests) {
|
|
||||||
if (origins[url]) {
|
|
||||||
return origins[url]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
function parseMediaInfo(streams) {
|
|
||||||
streams = streams.filter(s => s.codec_type === 'video')
|
|
||||||
streams = streams.map(s => {
|
|
||||||
s.bitrate = s.tags && s.tags.variant_bitrate ? parseInt(s.tags.variant_bitrate) : 0
|
|
||||||
s.frame_rate = parseFrameRate(s.avg_frame_rate)
|
|
||||||
|
|
||||||
return s
|
|
||||||
})
|
|
||||||
streams = _.orderBy(streams, ['height', 'bitrate'], ['desc', 'desc'])
|
|
||||||
|
|
||||||
return _.head(streams) || {}
|
|
||||||
}
|
|
||||||
|
|
||||||
function parseFrameRate(frame_rate = '0/0') {
|
|
||||||
const parts = frame_rate.split('/')
|
|
||||||
const number = parseInt(parts[0]) / parseInt(parts[1])
|
|
||||||
|
|
||||||
return number > 0 ? Math.round(number * 100) / 100 : 0
|
|
||||||
}
|
|
||||||
|
|
||||||
function parseStatus(error) {
|
|
||||||
if (!error) return 'online'
|
|
||||||
|
|
||||||
switch (error.code) {
|
|
||||||
case 'FFMPEG_UNDEFINED':
|
|
||||||
return null
|
|
||||||
case 'HTTP_REQUEST_TIMEOUT':
|
|
||||||
return 'timeout'
|
|
||||||
case 'HTTP_FORBIDDEN':
|
|
||||||
case 'HTTP_UNAUTHORIZED':
|
|
||||||
case 'HTTP_UNAVAILABLE_FOR_LEGAL_REASONS':
|
|
||||||
return 'blocked'
|
|
||||||
default:
|
|
||||||
return 'error'
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
const { create: createPlaylist } = require('../../core/playlist')
|
|
||||||
const { db, logger, file } = require('../../core')
|
|
||||||
const { orderBy } = require('natural-orderby')
|
|
||||||
const _ = require('lodash')
|
|
||||||
|
|
||||||
async function main() {
|
|
||||||
await db.streams.load()
|
|
||||||
let streams = await db.streams.find({})
|
|
||||||
const levels = { online: 1, blocked: 2, timeout: 3, error: 4, default: 5 }
|
|
||||||
streams = orderBy(
|
|
||||||
streams,
|
|
||||||
[
|
|
||||||
'channel',
|
|
||||||
s => (s.channel ? '' : s.title),
|
|
||||||
s => levels[s.status] || levels['default'],
|
|
||||||
'height',
|
|
||||||
'frame_rate',
|
|
||||||
'url'
|
|
||||||
],
|
|
||||||
['asc', 'asc', 'asc', 'desc', 'desc', 'asc']
|
|
||||||
)
|
|
||||||
|
|
||||||
const files = _.groupBy(streams, 'filepath')
|
|
||||||
for (const filepath in files) {
|
|
||||||
const playlist = createPlaylist(files[filepath], { public: false })
|
|
||||||
await file.create(filepath, playlist.toString())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
main()
|
|
@ -1 +1 @@
|
|||||||
[{"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-08-09T02:54:12Z","checked_at":"2022-08-09T02:54:12Z","updated_at":"2022-08-09T02:54:12Z"},{"channel":"BBCNews.uk","url":"http://1111296894.rsc.cdn77.org/LS-ATL-54548-6/index.m3u8","http_referrer":null,"user_agent":null,"status":"blocked","added_at":"2022-08-09T02:54:12Z","checked_at":"2022-08-09T02:54:12Z","updated_at":"2022-08-09T02:54:12Z"},{"channel":"BBCNewsHD.uk","url":"https://master.starmena-cloud.com/hls/bbc.m3u8","http_referrer":null,"user_agent":null,"status":"online","width":1024,"height":576,"bitrate":0,"frame_rate":25,"added_at":"2022-08-09T02:54:12Z","checked_at":"2022-08-09T02:54:12Z","updated_at":"2022-08-09T02:54:12Z"},{"channel":"KayhanTV.af","url":"http://208.93.117.113/live/Stream1/playlist.m3u8","http_referrer":null,"user_agent":null,"status":"error"},{"channel":"LDPRTV.ru","url":"http://46.46.143.222:1935/live/mp4:ldpr.stream/playlist.m3u8","http_referrer":null,"user_agent":null,"status":"error"},{"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-08-09T02:54:12Z","updated_at":"2022-07-07T00:00:00Z"},{"channel":"Sharq.af","url":"https://forerunnerrtmp.livestreamingcdn.com/output18/output18.stream/playlist.m3u8","http_referrer":null,"user_agent":null,"status":"online","width":1280,"height":720,"bitrate":2226543,"frame_rate":25,"added_at":"2022-08-09T02:54:12Z","checked_at":"2022-08-09T02:54:12Z","updated_at":"2022-08-09T02:54:12Z"}]
|
[{"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"},{"channel":"BBCNews.uk","url":"http://1111296894.rsc.cdn77.org/LS-ATL-54548-6/index.m3u8","http_referrer":null,"user_agent":null},{"channel":"BBCNewsHD.uk","url":"https://master.starmena-cloud.com/hls/bbc.m3u8","http_referrer":null,"user_agent":null},{"channel":"KayhanTV.af","url":"http://208.93.117.113/live/Stream1/playlist.m3u8","http_referrer":null,"user_agent":null},{"channel":"LDPRTV.ru","url":"http://46.46.143.222:1935/live/mp4:ldpr.stream/playlist.m3u8","http_referrer":null,"user_agent":null},{"channel":"LibyasChannel.ly","url":"https://master.starmena-cloud.com/hls/libyas.m3u8","http_referrer":null,"user_agent":null},{"channel":"Sharq.af","url":"https://forerunnerrtmp.livestreamingcdn.com/output18/output18.stream/playlist.m3u8","http_referrer":null,"user_agent":null}]
|
@ -1 +1 @@
|
|||||||
#EXTM3U x-tvg-url=""
|
#EXTM3U
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
#EXTM3U x-tvg-url="https://iptv-org.github.io/epg/guides/uk/ontvtonight.com.epg.xml"
|
#EXTM3U
|
||||||
#EXTINF:-1 tvg-id="BBCNews.uk" tvg-logo="https://raw.githubusercontent.com/Tapiosinn/tv-logos/master/countries/united-kingdom/bbc-news-uk.png" group-title="General;News",BBC News HD
|
#EXTINF:-1 tvg-id="BBCNews.uk" tvg-logo="https://raw.githubusercontent.com/Tapiosinn/tv-logos/master/countries/united-kingdom/bbc-news-uk.png" group-title="General;News",BBC News HD
|
||||||
http://1111296894.rsc.cdn77.org/LS-ATL-54548-6/index.m3u8
|
http://1111296894.rsc.cdn77.org/LS-ATL-54548-6/index.m3u8
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
#EXTM3U x-tvg-url=""
|
#EXTM3U
|
||||||
#EXTINF:-1 tvg-id="MeteoMedia.ca" tvg-logo="https://s1.twnmm.com/images/en_ca/mobile/logos/twn-mobile-logo.png" group-title="Weather",Meteomedia
|
#EXTINF:-1 tvg-id="MeteoMedia.ca" tvg-logo="https://s1.twnmm.com/images/en_ca/mobile/logos/twn-mobile-logo.png" group-title="Weather",Meteomedia
|
||||||
http://encodercdn1.frontline.ca/encoder181/output/Meteo_Media_720p/playlist.m3u8
|
http://encodercdn1.frontline.ca/encoder181/output/Meteo_Media_720p/playlist.m3u8
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
#EXTM3U x-tvg-url=""
|
#EXTM3U
|
||||||
#EXTINF:-1 tvg-id="VisitXTV.nl" tvg-logo="https://i.imgur.com/RJ9wbNF.jpg" group-title="XXX",Visit-X TV
|
#EXTINF:-1 tvg-id="VisitXTV.nl" tvg-logo="https://i.imgur.com/RJ9wbNF.jpg" group-title="XXX",Visit-X TV
|
||||||
https://stream.visit-x.tv/vxtv/ngrp:live_all/60fps.m3u8
|
https://stream.visit-x.tv/vxtv/ngrp:live_all/30fps.m3u8
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
#EXTM3U x-tvg-url=""
|
#EXTM3U
|
||||||
|
#EXTINF:-1 tvg-id="AndorraTV.ad" tvg-logo="" group-title="Undefined",ATV
|
||||||
|
https://iptv-all.lanesh4d0w.repl.co/andorra/atv
|
||||||
#EXTINF:-1 tvg-id="Zoo.ad" tvg-logo="" group-title="Undefined",Zoo (720p)
|
#EXTINF:-1 tvg-id="Zoo.ad" tvg-logo="" group-title="Undefined",Zoo (720p)
|
||||||
https://iptv-all.lanesh4d0w.repl.co/andorra/zoo
|
https://iptv-all.lanesh4d0w.repl.co/andorra/zoo
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
#EXTM3U x-tvg-url=""
|
#EXTM3U
|
||||||
#EXTINF:-1 tvg-id="MeteoMedia.ca" tvg-logo="https://s1.twnmm.com/images/en_ca/mobile/logos/twn-mobile-logo.png" group-title="Weather",Meteomedia
|
#EXTINF:-1 tvg-id="MeteoMedia.ca" tvg-logo="https://s1.twnmm.com/images/en_ca/mobile/logos/twn-mobile-logo.png" group-title="Weather",Meteomedia
|
||||||
http://encodercdn1.frontline.ca/encoder181/output/Meteo_Media_720p/playlist.m3u8
|
http://encodercdn1.frontline.ca/encoder181/output/Meteo_Media_720p/playlist.m3u8
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
#EXTM3U x-tvg-url=""
|
#EXTM3U
|
||||||
#EXTINF:-1 tvg-id="" tvg-logo="" group-title="Undefined",Daawah TV
|
#EXTINF:-1 tvg-id="" tvg-logo="" group-title="Undefined",Daawah TV
|
||||||
http://51.15.246.58:8081/daawahtv/daawahtv2/playlist.m3u8
|
http://51.15.246.58:8081/daawahtv/daawahtv2/playlist.m3u8
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
#EXTM3U x-tvg-url="https://iptv-org.github.io/epg/guides/uk/ontvtonight.com.epg.xml"
|
#EXTM3U
|
||||||
#EXTINF:-1 tvg-id="BBCNews.uk" tvg-logo="https://raw.githubusercontent.com/Tapiosinn/tv-logos/master/countries/united-kingdom/bbc-news-uk.png" group-title="General;News",BBC News HD
|
#EXTINF:-1 tvg-id="BBCNews.uk" tvg-logo="https://raw.githubusercontent.com/Tapiosinn/tv-logos/master/countries/united-kingdom/bbc-news-uk.png" group-title="General;News",BBC News HD
|
||||||
http://1111296894.rsc.cdn77.org/LS-ATL-54548-6/index.m3u8
|
http://1111296894.rsc.cdn77.org/LS-ATL-54548-6/index.m3u8
|
||||||
|
@ -1 +1 @@
|
|||||||
#EXTM3U x-tvg-url=""
|
#EXTM3U
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
#EXTM3U x-tvg-url=""
|
#EXTM3U
|
||||||
#EXTINF:-1 tvg-id="MeteoMedia.ca" tvg-logo="https://s1.twnmm.com/images/en_ca/mobile/logos/twn-mobile-logo.png" group-title="Weather",Meteomedia
|
#EXTINF:-1 tvg-id="MeteoMedia.ca" tvg-logo="https://s1.twnmm.com/images/en_ca/mobile/logos/twn-mobile-logo.png" group-title="Weather",Meteomedia
|
||||||
http://encodercdn1.frontline.ca/encoder181/output/Meteo_Media_720p/playlist.m3u8
|
http://encodercdn1.frontline.ca/encoder181/output/Meteo_Media_720p/playlist.m3u8
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
#EXTM3U x-tvg-url=""
|
#EXTM3U
|
||||||
#EXTINF:-1 tvg-id="" tvg-logo="" group-title="Undefined",Daawah TV
|
#EXTINF:-1 tvg-id="" tvg-logo="" group-title="Undefined",Daawah TV
|
||||||
http://51.15.246.58:8081/daawahtv/daawahtv2/playlist.m3u8
|
http://51.15.246.58:8081/daawahtv/daawahtv2/playlist.m3u8
|
||||||
|
@ -1 +1 @@
|
|||||||
#EXTM3U x-tvg-url=""
|
#EXTM3U
|
||||||
|
@ -1 +1 @@
|
|||||||
#EXTM3U x-tvg-url=""
|
#EXTM3U
|
||||||
|
@ -1 +1 @@
|
|||||||
#EXTM3U x-tvg-url=""
|
#EXTM3U
|
||||||
|
@ -1 +1 @@
|
|||||||
#EXTM3U x-tvg-url=""
|
#EXTM3U
|
||||||
|
@ -1 +1 @@
|
|||||||
#EXTM3U x-tvg-url=""
|
#EXTM3U
|
||||||
|
@ -1 +1 @@
|
|||||||
#EXTM3U x-tvg-url=""
|
#EXTM3U
|
||||||
|
@ -1 +1 @@
|
|||||||
#EXTM3U x-tvg-url=""
|
#EXTM3U
|
||||||
|
@ -1 +1 @@
|
|||||||
#EXTM3U x-tvg-url=""
|
#EXTM3U
|
||||||
|
@ -1 +1 @@
|
|||||||
#EXTM3U x-tvg-url=""
|
#EXTM3U
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
#EXTM3U x-tvg-url=""
|
#EXTM3U
|
||||||
#EXTINF:-1 tvg-id="MeteoMedia.ca" tvg-logo="https://s1.twnmm.com/images/en_ca/mobile/logos/twn-mobile-logo.png" group-title="Weather",Meteomedia
|
#EXTINF:-1 tvg-id="MeteoMedia.ca" tvg-logo="https://s1.twnmm.com/images/en_ca/mobile/logos/twn-mobile-logo.png" group-title="Weather",Meteomedia
|
||||||
http://encodercdn1.frontline.ca/encoder181/output/Meteo_Media_720p/playlist.m3u8
|
http://encodercdn1.frontline.ca/encoder181/output/Meteo_Media_720p/playlist.m3u8
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
#EXTM3U x-tvg-url=""
|
#EXTM3U
|
||||||
#EXTINF:-1 tvg-id="MeteoMedia.ca" tvg-logo="https://s1.twnmm.com/images/en_ca/mobile/logos/twn-mobile-logo.png" group-title="Weather",Meteomedia
|
#EXTINF:-1 tvg-id="MeteoMedia.ca" tvg-logo="https://s1.twnmm.com/images/en_ca/mobile/logos/twn-mobile-logo.png" group-title="Weather",Meteomedia
|
||||||
http://encodercdn1.frontline.ca/encoder181/output/Meteo_Media_720p/playlist.m3u8
|
http://encodercdn1.frontline.ca/encoder181/output/Meteo_Media_720p/playlist.m3u8
|
||||||
|
@ -1 +1 @@
|
|||||||
#EXTM3U x-tvg-url=""
|
#EXTM3U
|
||||||
|
@ -1 +1 @@
|
|||||||
#EXTM3U x-tvg-url=""
|
#EXTM3U
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
#EXTM3U x-tvg-url=""
|
#EXTM3U
|
||||||
#EXTINF:-1 tvg-id="" tvg-logo="" group-title="Undefined",Daawah TV
|
#EXTINF:-1 tvg-id="" tvg-logo="" group-title="Undefined",Daawah TV
|
||||||
http://51.15.246.58:8081/daawahtv/daawahtv2/playlist.m3u8
|
http://51.15.246.58:8081/daawahtv/daawahtv2/playlist.m3u8
|
||||||
|
@ -1 +1 @@
|
|||||||
#EXTM3U x-tvg-url=""
|
#EXTM3U
|
||||||
|
@ -1 +1 @@
|
|||||||
#EXTM3U x-tvg-url=""
|
#EXTM3U
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
#EXTM3U x-tvg-url=""
|
#EXTM3U
|
||||||
#EXTINF:-1 tvg-id="MeteoMedia.ca" tvg-logo="https://s1.twnmm.com/images/en_ca/mobile/logos/twn-mobile-logo.png" group-title="Weather",Meteomedia
|
#EXTINF:-1 tvg-id="MeteoMedia.ca" tvg-logo="https://s1.twnmm.com/images/en_ca/mobile/logos/twn-mobile-logo.png" group-title="Weather",Meteomedia
|
||||||
http://encodercdn1.frontline.ca/encoder181/output/Meteo_Media_720p/playlist.m3u8
|
http://encodercdn1.frontline.ca/encoder181/output/Meteo_Media_720p/playlist.m3u8
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
{"title":"BBC News HD","channel":"BBCNews.uk","filepath":"tests/__data__/output/streams/uk.m3u","url":"http://1111296894.rsc.cdn77.org/LS-ATL-54548-6/index.m3u8","http_referrer":null,"user_agent":null,"cluster_id":3,"_id":"3TbieV1ptnZVCIdn","status":"blocked"}
|
|
||||||
{"title":"BBC News HD","channel":"BBCNewsHD.uk","filepath":"tests/__data__/output/streams/uk.m3u","url":"https://master.starmena-cloud.com/hls/bbc.m3u8","http_referrer":null,"user_agent":null,"cluster_id":3,"_id":"WTbieV1ptnXVCIdn","status":"online","bitrate":0,"frame_rate":25,"width":1024,"height":576}
|
|
||||||
{"title":"Libyas Channel","channel":"LibyasChannel.ly","filepath":"tests/__data__/output/streams/ly.m3u","url":"https://master.starmena-cloud.com/hls/libyas.m3u8","http_referrer":null,"user_agent":null,"cluster_id":3,"_id":"WTbieV1ptnZVCIdn","status":"online","bitrate":0,"frame_rate":25,"width":1024,"height":576}
|
|
||||||
{"title":"辽源新闻综合 [Geo-blocked]","channel":null,"filepath":"channels/cn.m3u","url":"http://stream2.jlntv.cn/liaoyuan1/sd/live.m3u8","http_referrer":null,"user_agent":null,"cluster_id":4,"_id":"a7iyA6cjtf1iWWAZ"}
|
|
||||||
{"title":"Tele 2000","channel":"Tele2000.pe","filepath":"tests/__data__/output/streams/pe.m3u","url":"https://servilive.com:3126/live/tele2000live.m3u8","http_referrer":null,"user_agent":null,"cluster_id":1,"_id":"cF0pFVzSn6xFMUF3"}
|
|
||||||
{"title":"Kayhan TV","channel":"KayhanTV.af","filepath":"channels/af.m3u","url":"http://208.93.117.113/live/Stream1/playlist.m3u8","http_referrer":null,"user_agent":null,"cluster_id":1,"_id":"cFFpFVzSn6xFMUF3","status":"error"}
|
|
||||||
{"title":"Sharq","channel":"Sharq.af","filepath":"channels/af.m3u","bitrate":2226543,"frame_rate":25,"width":1280,"height":720,"url":"https://forerunnerrtmp.livestreamingcdn.com/output18/output18.stream/playlist.m3u8","http_referrer":null,"user_agent":null,"cluster_id":1,"_id":"u7iyA6cjtf1iWWAZ","status":"online"}
|
|
@ -1,6 +1,6 @@
|
|||||||
{"channel":null,"title":"TVN","filepath":"tests/__data__/input/streams/us_blocked.m3u","url":"https://example.com/playlist2.m3u8","http_referrer":null,"user_agent":null,"cluster_id":1,"_id":"UAYbCvjOWvqXHH95"}
|
{"channel":null,"title":"TVN","filepath":"tests/__data__/input/streams/us_blocked.m3u","url":"https://example.com/playlist2.m3u8","http_referrer":null,"user_agent":null,"_id":"UAYbCvjOWvqXHH95"}
|
||||||
{"channel":"LibyasChannel.ly","title":"Libyas Channel","filepath":"tests/__data__/input/streams/ly.m3u","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","updated_at":"2022-07-07T00:00:00Z","checked_at":"2022-07-07T00:00:00Z","cluster_id":1,"_id":"I0rJlwp3rZEy2SnG"}
|
{"channel":"LibyasChannel.ly","title":"Libyas Channel","filepath":"tests/__data__/input/streams/ly.m3u","url":"https://master.starmena-cloud.com/hls/libyas.m3u8","http_referrer":null,"user_agent":null,"_id":"I0rJlwp3rZEy2SnG"}
|
||||||
{"channel":"EverydayHeroes.us","title":"Everyday Heroes (720p)","filepath":"tests/__data__/input/streams/us_blocked.m3u","url":"https://a.jsrdn.com/broadcast/7b1451fa52/+0000/c.m3u8","http_referrer":null,"user_agent":null,"cluster_id":1,"_id":"tdzk1IN7wLJxfGab"}
|
{"channel":"EverydayHeroes.us","title":"Everyday Heroes (720p)","filepath":"tests/__data__/input/streams/us_blocked.m3u","url":"https://a.jsrdn.com/broadcast/7b1451fa52/+0000/c.m3u8","http_referrer":null,"user_agent":null,"_id":"tdzk1IN7wLJxfGab"}
|
||||||
{"channel":null,"title":"ATV (720p) [Offline]","filepath":"tests/__data__/input/streams/ad.m3u","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","cluster_id":1,"_id":"3evMHt3nFsZjhzas"}
|
{"channel":null,"title":"ATV (720p) [Offline]","filepath":"tests/__data__/input/streams/ad.m3u","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","_id":"3evMHt3nFsZjhzas"}
|
||||||
{"channel":null,"title":"ABC (720p)","filepath":"tests/__data__/input/streams/wrong_id.m3u","url":"https://example.com/playlist2.m3u8","http_referrer":null,"user_agent":null,"cluster_id":1,"_id":"agJlTEr8wwpbWgw0"}
|
{"channel":null,"title":"ABC (720p)","filepath":"tests/__data__/input/streams/wrong_id.m3u","url":"https://example.com/playlist2.m3u8","http_referrer":null,"user_agent":null,"_id":"agJlTEr8wwpbWgw0"}
|
||||||
{"channel":null,"title":"Fox Sports 2 Asia (Thai) (720p)","filepath":"tests/__data__/input/streams/us_blocked.m3u","url":"https://example.com/playlist.m3u8","http_referrer":null,"user_agent":null,"cluster_id":1,"_id":"FpMhoWjtpnVuYlO9"}
|
{"channel":null,"title":"Fox Sports 2 Asia (Thai) (720p)","filepath":"tests/__data__/input/streams/us_blocked.m3u","url":"https://example.com/playlist.m3u8","http_referrer":null,"user_agent":null,"_id":"FpMhoWjtpnVuYlO9"}
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
{"_id":"2ST8btby3mmsgPF0","error":{"code":"HTTP_REQUEST_TIMEOUT","message":"HTTP 408 Request Timeout"},"streams":[],"requests":[]}
|
|
||||||
{"_id":"I6cjG2xCBRFFP4sz","error":{"code":"HTTP_REQUEST_TIMEOUT","message":"HTTP 408 Request Timeout"},"streams":[],"requests":[]}
|
|
@ -1 +1 @@
|
|||||||
{"filepath":"index.category.m3u","count":7}
|
{"filepath":"index.category.m3u","count":8}
|
@ -1 +1 @@
|
|||||||
{"filepath":"index.country.m3u","count":6}
|
{"filepath":"index.country.m3u","count":7}
|
@ -1 +1 @@
|
|||||||
{"filepath":"index.language.m3u","count":6}
|
{"filepath":"index.language.m3u","count":7}
|
@ -1 +1 @@
|
|||||||
{"filepath":"index.m3u","count":6}
|
{"filepath":"index.m3u","count":7}
|
@ -1 +1 @@
|
|||||||
{"filepath":"index.nsfw.m3u","count":7}
|
{"filepath":"index.nsfw.m3u","count":8}
|
@ -1 +1 @@
|
|||||||
{"filepath":"index.region.m3u","count":20}
|
{"filepath":"index.region.m3u","count":23}
|
@ -1,3 +1,4 @@
|
|||||||
{"filepath":"languages/eng.m3u","count":1}
|
{"filepath":"languages/eng.m3u","count":1}
|
||||||
{"filepath":"languages/rus.m3u","count":1}
|
{"filepath":"languages/rus.m3u","count":1}
|
||||||
|
{"filepath":"languages/cat.m3u","count":1}
|
||||||
{"filepath":"languages/undefined.m3u","count":4}
|
{"filepath":"languages/undefined.m3u","count":4}
|
@ -1,5 +0,0 @@
|
|||||||
#EXTM3U
|
|
||||||
#EXTINF:-1 tvg-id="AndorraTV.ad" status="timeout" user-agent="Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148",ATV (720p) [Offline]
|
|
||||||
#EXTVLCOPT:http-referrer=http://imn.iq
|
|
||||||
#EXTVLCOPT:http-user-agent=Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148
|
|
||||||
https://iptv-all.lanesh4d0w.repl.co/andorra/atv
|
|
@ -1,6 +0,0 @@
|
|||||||
#EXTM3U
|
|
||||||
#EXTINF:-1 tvg-id="Telearuba.aw" status="online",Telearuba (720p)
|
|
||||||
http://cdn.setar.aw:1935/Telearuba/smil:telearuba.smil/playlist.m3u8
|
|
||||||
#EXTINF:-1 tvg-id="Telearuba.aw" status="online" user-agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36",Telearuba (480p) [Not 24/7]
|
|
||||||
#EXTVLCOPT:http-user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36
|
|
||||||
https://backend-server-dot-telearuba-app.appspot.com/media/livestream13/playlist.m3u8
|
|
@ -1,7 +0,0 @@
|
|||||||
#EXTM3U
|
|
||||||
#EXTINF:-1 tvg-id="" status="error",Caillou
|
|
||||||
https://dhx-caillou-1-es.samsung.wurl.tv/playlist.m3u8
|
|
||||||
#EXTINF:-1 tvg-id="" status="online",iHola Play
|
|
||||||
https://rakuten-hola-2-es.samsung.wurl.tv/playlist.m3u8
|
|
||||||
#EXTINF:-1 tvg-id="" status="online",Planeta Junior TV
|
|
||||||
https://deaplaneta-planetakidz-1-es.samsung.wurl.tv/playlist.m3u8
|
|
@ -1,11 +0,0 @@
|
|||||||
#EXTM3U
|
|
||||||
#EXTINF:-1 tvg-id="NPO1.nl" status="blocked",NPO 1 (1080p) [Geo-blocked]
|
|
||||||
http://stream.tvtap.net:8081/live/nl-npo1.stream/60fps.m3u8
|
|
||||||
#EXTINF:-1 tvg-id="NPO1.nl" status="blocked",NPO 1 (1080p) [Geo-blocked]
|
|
||||||
http://stream.tvtap.net:8081/live/nl-npo1.stream/30fps.m3u8
|
|
||||||
#EXTINF:-1 tvg-id="NPO1.nl" status="error",NPO 1 (342p) [Geo-blocked]
|
|
||||||
http://resolver.streaming.api.nos.nl/livestream?url=/live/npo/tvlive/npo1/npo1.isml/.m3u8
|
|
||||||
#EXTINF:-1 tvg-id="NPO2.nl" status="online",NPO 2 (342p)
|
|
||||||
http://resolver.streaming.api.nos.nl/livestream?url=/live/npo/tvlive/npo2/npo2.isml/.m3u8
|
|
||||||
#EXTINF:-1 tvg-id="NPO2.nl" status="blocked",NPO 2 (302p) [Geo-blocked]
|
|
||||||
http://stream.tvtap.net:8081/live/nl-npo2.stream/playlist.m3u8
|
|
@ -1,3 +0,0 @@
|
|||||||
#EXTM3U
|
|
||||||
#EXTINF:-1 tvg-id="Tele2000.pe",Tele 2000
|
|
||||||
https://servilive.com:3126/live/tele2000live.m3u8
|
|
@ -1,5 +0,0 @@
|
|||||||
#EXTM3U
|
|
||||||
#EXTINF:-1 tvg-id="BBCNews.uk" status="online",BBC News HD (480p) [Geo-blocked]
|
|
||||||
http://1111296894.rsc.cdn77.org/LS-ATL-54548-6/playlist.m3u8
|
|
||||||
#EXTINF:-1 tvg-id="BBCNews.uk" status="error",BBC News HD (720p) [Not 24/7]
|
|
||||||
http://1111296894.rsc.cdn77.org/LS-ATL-54548-6/index.m3u8
|
|
File diff suppressed because one or more lines are too long
@ -1 +0,0 @@
|
|||||||
[{"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"}]
|
|
@ -1,6 +0,0 @@
|
|||||||
{"_id":"2ST8btby3mmsgPF0","error":{"code":"HTTP_REQUEST_TIMEOUT","message":"HTTP 408 Request Timeout"},"streams":[],"requests":[]}
|
|
||||||
{"_id":"I6cjG2xCBRFFP4sz","error":{"code":"FFMPEG_STREAMS_NOT_FOUND","message":"FFMPEG Streams Not Found"},"streams":[],"requests":[]}
|
|
||||||
{"_id":"3TbieV1ptnZVCIdn","error":{"code":"HTTP_FORBIDDEN","message":"HTTP 403 Forbidden"},"streams":[],"requests":[]}
|
|
||||||
{"_id":"cFFpFVzSn6xFMUF3","error":{"code":"HTTP_NOT_FOUND","message":"HTTP 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":"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":"1000/3","avg_frame_rate":"30000/1001","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"}}]}
|
|
@ -1,5 +1,5 @@
|
|||||||
#EXTM3U
|
#EXTM3U
|
||||||
#EXTINF:-1 tvg-id="ATV.ad" tvg-country="AD" tvg-language="Catalan" tvg-logo="https://i.imgur.com/kJCjeQ4.png" group-title="General" user-agent="Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148",ATV (720p) [Offline]
|
#EXTINF:-1 tvg-id="ATV.ad" user-agent="Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148",ATV (720p) [Offline]
|
||||||
#EXTVLCOPT:http-referrer=http://imn.iq
|
#EXTVLCOPT:http-referrer=http://imn.iq
|
||||||
#EXTVLCOPT:http-user-agent=Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148
|
#EXTVLCOPT:http-user-agent=Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148
|
||||||
https://iptv-all.lanesh4d0w.repl.co/andorra/atv
|
https://iptv-all.lanesh4d0w.repl.co/andorra/atv
|
@ -1,3 +1,3 @@
|
|||||||
#EXTM3U
|
#EXTM3U
|
||||||
#EXTINF:-1 tvg-id="" tvg-country="" tvg-language="" tvg-logo="" group-title="",1A Network (720p)
|
#EXTINF:-1 tvg-id="",1A Network (720p)
|
||||||
https://simultv.s.llnwi.net/n4s4/2ANetwork/interlink.m3u8
|
https://simultv.s.llnwi.net/n4s4/2ANetwork/interlink.m3u8
|
||||||
|
@ -0,0 +1,28 @@
|
|||||||
|
const { execSync } = require('child_process')
|
||||||
|
const fs = require('fs-extra')
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fs.emptyDirSync('tests/__data__/output')
|
||||||
|
fs.mkdirSync('tests/__data__/output/database')
|
||||||
|
fs.copyFileSync(
|
||||||
|
'tests/__data__/input/database/api_generate.streams.db',
|
||||||
|
'tests/__data__/output/database/streams.db'
|
||||||
|
)
|
||||||
|
|
||||||
|
const stdout = execSync(
|
||||||
|
'DB_DIR=tests/__data__/output/database DATA_DIR=tests/__data__/input/data PUBLIC_DIR=tests/__data__/output/.api npm run api:generate',
|
||||||
|
{ encoding: 'utf8' }
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('can create streams.json', () => {
|
||||||
|
expect(content(`output/.api/streams.json`)).toMatchObject(content(`expected/.api/streams.json`))
|
||||||
|
})
|
||||||
|
|
||||||
|
function content(filepath) {
|
||||||
|
return JSON.parse(
|
||||||
|
fs.readFileSync(`tests/__data__/${filepath}`, {
|
||||||
|
encoding: 'utf8'
|
||||||
|
})
|
||||||
|
)
|
||||||
|
}
|
@ -1,35 +0,0 @@
|
|||||||
const { execSync } = require('child_process')
|
|
||||||
const fs = require('fs-extra')
|
|
||||||
const path = require('path')
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
fs.emptyDirSync('tests/__data__/output')
|
|
||||||
fs.copyFileSync(
|
|
||||||
'tests/__data__/input/database/cluster_load.streams.db',
|
|
||||||
'tests/__data__/output/streams.db'
|
|
||||||
)
|
|
||||||
|
|
||||||
const stdout = execSync(
|
|
||||||
'DB_DIR=tests/__data__/output LOGS_DIR=tests/__data__/output/logs/cluster/load npm run cluster:load -- --cluster-id=1 --timeout=1',
|
|
||||||
{ encoding: 'utf8' }
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
it('return results', () => {
|
|
||||||
expect(content('tests/__data__/output/logs/cluster/load/cluster_1.log')).toEqual(
|
|
||||||
content('tests/__data__/expected/logs/cluster/load/cluster_1.log')
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
function content(filepath) {
|
|
||||||
const data = fs.readFileSync(path.resolve(filepath), {
|
|
||||||
encoding: 'utf8'
|
|
||||||
})
|
|
||||||
|
|
||||||
return data
|
|
||||||
.split('\n')
|
|
||||||
.filter(l => l)
|
|
||||||
.map(l => {
|
|
||||||
return JSON.parse(l)
|
|
||||||
})
|
|
||||||
}
|
|
@ -1,48 +0,0 @@
|
|||||||
const fs = require('fs-extra')
|
|
||||||
const path = require('path')
|
|
||||||
const { execSync } = require('child_process')
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
fs.emptyDirSync('tests/__data__/output')
|
|
||||||
fs.mkdirSync('tests/__data__/output/database')
|
|
||||||
fs.copyFileSync(
|
|
||||||
'tests/__data__/input/database/db_clear.streams.db',
|
|
||||||
'tests/__data__/output/database/streams.db'
|
|
||||||
)
|
|
||||||
|
|
||||||
const stdout = execSync(
|
|
||||||
'DB_DIR=tests/__data__/output/database npm run db:clear -- --threshold 7',
|
|
||||||
{
|
|
||||||
encoding: 'utf8'
|
|
||||||
}
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
it('can clear database', () => {
|
|
||||||
let output = content('tests/__data__/output/database/streams.db')
|
|
||||||
let expected = content('tests/__data__/expected/database/db_clear.streams.db')
|
|
||||||
|
|
||||||
output = output.map(i => {
|
|
||||||
i._id = null
|
|
||||||
return i
|
|
||||||
})
|
|
||||||
expected = expected.map(i => {
|
|
||||||
i._id = null
|
|
||||||
return i
|
|
||||||
})
|
|
||||||
|
|
||||||
expect(output).toMatchObject(expected)
|
|
||||||
})
|
|
||||||
|
|
||||||
function content(filepath) {
|
|
||||||
const data = fs.readFileSync(path.resolve(filepath), {
|
|
||||||
encoding: 'utf8'
|
|
||||||
})
|
|
||||||
|
|
||||||
return data
|
|
||||||
.split('\n')
|
|
||||||
.filter(l => l)
|
|
||||||
.map(l => {
|
|
||||||
return JSON.parse(l)
|
|
||||||
})
|
|
||||||
}
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue