From a3af354b143f2f0ce3eb8dc176e99fcae4182693 Mon Sep 17 00:00:00 2001
From: freearhey <free.arhey@gmail.com>
Date: Thu, 6 May 2021 16:27:16 +0300
Subject: [PATCH] Update parser.js

---
 scripts/parser.js | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/scripts/parser.js b/scripts/parser.js
index 5def3eacb..10bad2ca7 100644
--- a/scripts/parser.js
+++ b/scripts/parser.js
@@ -32,7 +32,8 @@ class Playlist {
       .filter(channel => channel.url)
   }
 
-  toString(short = false) {
+  toString(options = {}) {
+    const config = { raw: false, ...options }
     let parts = ['#EXTM3U']
     for (let key in this.header.attrs) {
       let value = this.header.attrs[key]
@@ -43,7 +44,7 @@ class Playlist {
 
     let output = `${parts.join(' ')}\n`
     for (let channel of this.channels) {
-      output += channel.toString(short)
+      output += channel.toString(config.raw)
     }
 
     return output
@@ -77,6 +78,7 @@ class Channel {
     this.countries = this.parseCountries(data.tvg.country)
     this.languages = this.parseLanguages(data.tvg.language)
     this.category = this.parseCategory(data.group.title)
+    this.raw = data.raw
   }
 
   parseCountries(string) {
@@ -181,15 +183,13 @@ class Channel {
     return ''
   }
 
-  toString(short = false) {
+  toString(raw = false) {
+    if (raw) return this.raw + '\n'
+
     this.tvg.country = this.tvg.country.toUpperCase()
 
     let info = `-1 tvg-id="${this.tvgId}" tvg-name="${this.tvgName}" tvg-country="${this.tvg.country}" tvg-language="${this.tvg.language}" tvg-logo="${this.logo}"`
 
-    if (!short) {
-      info += ` tvg-url="${this.tvgUrl}"`
-    }
-
     info += ` group-title="${this.category}",${this.name}`
 
     if (this.resolution.height) {