mirror of
https://github.com/iptv-org/iptv.git
synced 2025-05-13 02:20:03 -04:00
Small repo refactoring
This commit is contained in:
parent
624bc78287
commit
ee754bc44e
6 changed files with 12 additions and 17 deletions
|
@ -8,7 +8,7 @@ Collection of 6000+ free IPTV channels from all over the world.
|
||||||
|
|
||||||
To open the playlist in VLC player you just need click `File` - > `Open Network...` and in the window that opens, insert a link to the playlist itself: `https://raw.githubusercontent.com/freearhey/iptv/master/index.m3u`
|
To open the playlist in VLC player you just need click `File` - > `Open Network...` and in the window that opens, insert a link to the playlist itself: `https://raw.githubusercontent.com/freearhey/iptv/master/index.m3u`
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
then just press the 'Open' button
|
then just press the 'Open' button
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ const parsers = require('playlist-parser')
|
||||||
const M3U = parsers.M3U
|
const M3U = parsers.M3U
|
||||||
const fs = require("fs")
|
const fs = require("fs")
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const helper = require('./helper')
|
const urlParser = require('url')
|
||||||
|
|
||||||
let outputPath = path.resolve(__dirname) + '/../index.all.m3u'
|
let outputPath = path.resolve(__dirname) + '/../index.all.m3u'
|
||||||
let channels = 0
|
let channels = 0
|
||||||
|
@ -59,13 +59,20 @@ function writeToFile(title, file) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function addToCache(url) {
|
function addToCache(url) {
|
||||||
let id = helper.getUrlPath(url)
|
let id = getUrlPath(url)
|
||||||
|
|
||||||
cache[id] = true
|
cache[id] = true
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkCache(url) {
|
function checkCache(url) {
|
||||||
let id = helper.getUrlPath(url)
|
let id = getUrlPath(url)
|
||||||
|
|
||||||
return cache.hasOwnProperty(id)
|
return cache.hasOwnProperty(id)
|
||||||
|
}
|
||||||
|
|
||||||
|
function getUrlPath(u) {
|
||||||
|
let parsed = urlParser.parse(u)
|
||||||
|
let searchQuery = parsed.search || ''
|
||||||
|
|
||||||
|
return parsed.host + parsed.pathname + searchQuery
|
||||||
}
|
}
|
Binary file not shown.
Before Width: | Height: | Size: 1 MiB |
|
@ -11,7 +11,7 @@
|
||||||
"main": "index.m3u",
|
"main": "index.m3u",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "node test/index.js",
|
"test": "node test/index.js",
|
||||||
"generate": "node src/generate.js"
|
"generate": "node helpers/generate.js"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
Before Width: | Height: | Size: 404 KiB After Width: | Height: | Size: 404 KiB |
|
@ -1,12 +0,0 @@
|
||||||
const parser = require('url')
|
|
||||||
|
|
||||||
function getUrlPath(u) {
|
|
||||||
let parsedUrl = parser.parse(u)
|
|
||||||
let searchQuery = parsedUrl.search || ''
|
|
||||||
|
|
||||||
return parsedUrl.host + parsedUrl.pathname + searchQuery
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
getUrlPath
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue