diff --git a/.github/workflows/auto-update.yml b/.github/workflows/auto-update.yml index ee106b84..ebb660ab 100644 --- a/.github/workflows/auto-update.yml +++ b/.github/workflows/auto-update.yml @@ -18,7 +18,6 @@ jobs: hd-plus.de, astro.com.my, comteco.com.bo, - albepg.com, mi.tv, meo.pt, tvgid.ua, @@ -35,8 +34,9 @@ jobs: tvtv.ca, tvtv.us, tv.lv, - vidio.com, - mncvision.id + mncvision.id, + tvguide.com, + tvprofil.com ] steps: - name: Checkout @@ -51,6 +51,7 @@ jobs: name: .gh-pages path: .gh-pages/guides/${{ matrix.site }}.guide.xml deploy: + if: ${{ github.ref == 'refs/heads/master' }} needs: grab runs-on: ubuntu-latest steps: @@ -58,6 +59,12 @@ jobs: uses: actions/checkout@v2 - name: Download Artifacts uses: actions/download-artifact@v2 + - name: Generate Token + uses: tibdex/github-app-token@v1 + id: generate-token + with: + app_id: ${{ secrets.APP_ID }} + private_key: ${{ secrets.APP_PRIVATE_KEY }} - name: Deploy to GitHub Pages uses: JamesIves/github-pages-deploy-action@4.1.1 with: @@ -65,3 +72,7 @@ jobs: folder: .gh-pages target-folder: guides clean: false + token: ${{ steps.generate-token.outputs.token }} + git-config-name: iptv-bot + git-config-email: 84861620+iptv-bot[bot]@users.noreply.github.com + commit-message: '[Bot] Deploy to GitHub Pages' diff --git a/.github/workflows/update-codes.yml b/.github/workflows/update-codes.yml index 640e0b82..a1bd3911 100644 --- a/.github/workflows/update-codes.yml +++ b/.github/workflows/update-codes.yml @@ -4,11 +4,27 @@ on: schedule: - cron: '0 0 * * *' jobs: - update: + create-branch: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 + with: + ref: ${{ github.ref }} + - name: Create Branch + uses: peterjgrainger/action-create-branch@v2.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + branch: 'bot/update-codes' + update-codes: + runs-on: ubuntu-latest + needs: create-branch + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + ref: bot/update-codes - name: Install Dependencies run: npm install - name: Update Codes @@ -18,16 +34,36 @@ jobs: with: name: codes.csv path: codes.csv + commit-changes: + runs-on: ubuntu-latest + needs: update-codes + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + ref: bot/update-codes + - name: Download Artifacts + uses: actions/download-artifact@v2 + with: + name: codes.csv + - name: Commit Changes + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: '[Bot] Update codes' + commit_user_name: iptv-bot + commit_user_email: 84861620+iptv-bot[bot]@users.noreply.github.com + commit_author: 'iptv-bot[bot] <84861620+iptv-bot[bot]@users.noreply.github.com>' + branch: bot/update-codes + file_pattern: codes.csv pull-request: - needs: update + if: ${{ github.ref == 'refs/heads/master' }} + needs: commit-changes runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 - - name: Download codes.csv - uses: actions/download-artifact@v2 with: - name: codes.csv + ref: bot/update-codes - name: Generate Token uses: tibdex/github-app-token@v1 id: generate-token @@ -36,26 +72,24 @@ jobs: private_key: ${{ secrets.APP_PRIVATE_KEY }} - name: Create Pull Request id: pr - uses: peter-evans/create-pull-request@v3 + uses: repo-sync/pull-request@v2 with: - title: '[Bot] Update codes' - body: | - This pull request is created automatically by `update-codes` action. - commit-message: '[Bot] Update codes' - committer: GitHub - branch: bot/update-codes - delete-branch: true - token: ${{ steps.generate-token.outputs.token }} + source_branch: 'bot/update-codes' + destination_branch: 'master' + pr_title: '[Bot] Update codes' + pr_body: | + This pull request is created by [update-codes][1] workflow. + + [1]: https://github.com/iptv-org/iptv/actions/runs/${{ github.run_id }} + github_token: ${{ steps.generate-token.outputs.token }} - name: Enable Pull Request Automerge - if: steps.pr.outputs.pull-request-operation == 'created' uses: peter-evans/enable-pull-request-automerge@v1 with: token: ${{ secrets.PAT }} - pull-request-number: ${{ steps.pr.outputs.pull-request-number }} + pull-request-number: ${{ steps.pr.outputs.pr_number }} merge-method: squash - name: Approve Pull Request - if: steps.pr.outputs.pull-request-operation == 'created' uses: juliangruber/approve-pull-request-action@v1 with: github-token: ${{ secrets.PAT }} - number: ${{ steps.pr.outputs.pull-request-number }} + number: ${{ steps.pr.outputs.pr_number }} diff --git a/README.md b/README.md index b6bc9c86..df339dbd 100644 --- a/README.md +++ b/README.md @@ -14,16 +14,19 @@ To load a program guide, all you need to do is copy the link to one of the guide CountryEPG - 🇦🇱 Albaniahttps://iptv-org.github.io/epg/guides/albepg.com.guide.xml + 🇦🇱 Albaniahttps://iptv-org.github.io/epg/guides/tvprofil.com.guide.xml 🇦🇩 Andorrahttps://iptv-org.github.io/epg/guides/andorradifusio.ad.guide.xml 🇦🇷 Argentinahttps://iptv-org.github.io/epg/guides/mi.tv.guide.xml 🇦🇺 Australiahttps://iptv-org.github.io/epg/guides/ontvtonight.com.guide.xml 🇧🇾 Belarushttps://iptv-org.github.io/epg/guides/tv.yandex.ru.guide.xml 🇧🇴 Boliviahttps://iptv-org.github.io/epg/guides/comteco.com.bo.guide.xml + 🇧🇦 Bosniahttps://iptv-org.github.io/epg/guides/tvprofil.com.guide.xml 🇧🇷 Brasilhttps://iptv-org.github.io/epg/guides/mi.tv.guide.xml + 🇧🇬 Bulgariahttps://iptv-org.github.io/epg/guides/tvprofil.com.guide.xml 🇨🇦 Canadahttps://iptv-org.github.io/epg/guides/tvtv.ca.guide.xml 🇨🇱 Chilehttps://iptv-org.github.io/epg/guides/mi.tv.guide.xml 🇨🇴 Colombiahttps://iptv-org.github.io/epg/guides/mi.tv.guide.xml + 🇭🇷 Croatiahttps://iptv-org.github.io/epg/guides/tvprofil.com.guide.xml 🇨🇿 Czechiahttps://iptv-org.github.io/epg/guides/m.tv.sms.cz.guide.xml 🇸🇻 El Salvadorhttps://iptv-org.github.io/epg/guides/mi.tv.guide.xml 🇫🇮 Finlandhttps://iptv-org.github.io/epg/guides/telkussa.fi.guide.xml @@ -33,18 +36,23 @@ To load a program guide, all you need to do is copy the link to one of the guide 🇬🇹 Guatemalahttps://iptv-org.github.io/epg/guides/mi.tv.guide.xml 🇭🇳 Hondurashttps://iptv-org.github.io/epg/guides/mi.tv.guide.xml 🇮🇩 Indonesiahttps://iptv-org.github.io/epg/guides/mncvision.id.guide.xml + 🇭🇺 Hungaryhttps://iptv-org.github.io/epg/guides/tvprofil.com.guide.xml 🇮🇹 Italyhttps://iptv-org.github.io/epg/guides/guidatv.sky.it.guide.xml 🇮🇪 Irelandhttps://iptv-org.github.io/epg/guides/ontvtonight.com.guide.xml 🇰🇿 Kazakhstanhttps://iptv-org.github.io/epg/guides/tv.yandex.ru.guide.xml 🇱🇻 Latviahttps://iptv-org.github.io/epg/guides/tv.lv.guide.xml 🇲🇾 Malaysiahttps://iptv-org.github.io/epg/guides/astro.com.my.guide.xml 🇲🇽 Mexicohttps://iptv-org.github.io/epg/guides/mi.tv.guide.xml + 🇲🇪 Montenegrohttps://iptv-org.github.io/epg/guides/tvprofil.com.guide.xml + 🇲🇰 North Macedoniahttps://iptv-org.github.io/epg/guides/tvprofil.com.guide.xml 🇵🇾 Paraguayhttps://iptv-org.github.io/epg/guides/mi.tv.guide.xml 🇵🇪 Peruhttps://iptv-org.github.io/epg/guides/mi.tv.guide.xml 🇵🇱 Polandhttps://iptv-org.github.io/epg/guides/programtv.onet.pl.guide.xml 🇵🇹 Portugalhttps://iptv-org.github.io/epg/guides/meo.pt.guide.xml 🇷🇴 Romaniahttps://iptv-org.github.io/epg/guides/programetv.ro.guide.xml 🇷🇺 Russiahttps://iptv-org.github.io/epg/guides/tv.yandex.ru.guide.xml + 🇷🇸 Serbiahttps://iptv-org.github.io/epg/guides/tvprofil.com.guide.xml + 🇸🇮 Sloveniahttps://iptv-org.github.io/epg/guides/tvprofil.com.guide.xml 🇪🇸 Spainhttps://iptv-org.github.io/epg/guides/programacion-tv.elpais.com.guide.xml 🇸🇪 Swedenhttps://iptv-org.github.io/epg/guides/telkussa.fi.guide.xml 🇹🇷 Turkeyhttps://iptv-org.github.io/epg/guides/digiturk.com.tr.guide.xml diff --git a/codes.csv b/codes.csv index 2ae650d2..998dbacc 100644 --- a/codes.csv +++ b/codes.csv @@ -858,6 +858,7 @@ beIN Sports 11,beINSports11.qa beIN Sports 12,beINSports12.qa beIN Sports 13,beINSports13.qa beIN Sports 2,beINSports2.qa +beIN Sports 2 Asia,beINSports2Asia.qa beIN Sports 3,beINSports3.qa beIN Sports Canada,beINSportsCanada.qa beIN Sports en Español,beINSportsenEspanol.qa diff --git a/package-lock.json b/package-lock.json index ab605491..1de7a29c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,10 +6,11 @@ "": { "license": "MIT", "dependencies": { + "form-data": "^4.0.0", + "cheerio": "^1.0.0-rc.10", "dayjs": "^1.10.4", "epg-grabber": "^0.6.6", "epg-parser": "^0.1.3", - "form-data": "^4.0.0", "glob": "^7.1.6", "html-to-text": "^7.0.0", "iconv-lite": "^0.4.24", @@ -140,6 +141,11 @@ "tweetnacl": "^0.14.3" } }, + "node_modules/boolbase": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", + "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=" + }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -159,6 +165,41 @@ "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" }, + "node_modules/cheerio": { + "version": "1.0.0-rc.10", + "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.10.tgz", + "integrity": "sha512-g0J0q/O6mW8z5zxQ3A8E8J1hUgp4SMOvEoW/x84OwyHKe/Zccz83PVT4y5Crcr530FV6NgmKI1qvGTKVl9XXVw==", + "dependencies": { + "cheerio-select": "^1.5.0", + "dom-serializer": "^1.3.2", + "domhandler": "^4.2.0", + "htmlparser2": "^6.1.0", + "parse5": "^6.0.1", + "parse5-htmlparser2-tree-adapter": "^6.0.1", + "tslib": "^2.2.0" + }, + "engines": { + "node": ">= 6" + }, + "funding": { + "url": "https://github.com/cheeriojs/cheerio?sponsor=1" + } + }, + "node_modules/cheerio-select": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/cheerio-select/-/cheerio-select-1.5.0.tgz", + "integrity": "sha512-qocaHPv5ypefh6YNxvnbABM07KMxExbtbfuJoIie3iZXX1ERwYmJcIiRrr9H05ucQP1k28dav8rpdDgjQd8drg==", + "dependencies": { + "css-select": "^4.1.3", + "css-what": "^5.0.1", + "domelementtype": "^2.2.0", + "domhandler": "^4.2.0", + "domutils": "^2.7.0" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, "node_modules/combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -188,6 +229,32 @@ "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" }, + "node_modules/css-select": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-4.1.3.tgz", + "integrity": "sha512-gT3wBNd9Nj49rAbmtFHj1cljIAOLYSX1nZ8CB7TBO3INYckygm5B7LISU/szY//YmdiSLbJvDLOx9VnMVpMBxA==", + "dependencies": { + "boolbase": "^1.0.0", + "css-what": "^5.0.0", + "domhandler": "^4.2.0", + "domutils": "^2.6.0", + "nth-check": "^2.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, + "node_modules/css-what": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/css-what/-/css-what-5.0.1.tgz", + "integrity": "sha512-FYDTSHb/7KXsWICVsxdmiExPjCfRC4qRFBdVwv7Ax9hMnvMmEjP9RfxTEZ3qPZGmADDn2vAKSo9UcN1jKVYscg==", + "engines": { + "node": ">= 6" + }, + "funding": { + "url": "https://github.com/sponsors/fb55" + } + }, "node_modules/cssom": { "version": "0.4.4", "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.4.4.tgz", @@ -265,19 +332,28 @@ } }, "node_modules/dom-serializer": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.2.0.tgz", - "integrity": "sha512-n6kZFH/KlCrqs/1GHMOd5i2fd/beQHuehKdWvNNffbGHTr/almdhuVvTVFb3V7fglz+nC50fFusu3lY33h12pA==", + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.3.2.tgz", + "integrity": "sha512-5c54Bk5Dw4qAxNOI1pFEizPSjVsx5+bpJKmL2kPn8JhBUq2q09tTCa3mjijun2NfK78NMouDYNMBkOrPZiS+ig==", "dependencies": { "domelementtype": "^2.0.1", - "domhandler": "^4.0.0", + "domhandler": "^4.2.0", "entities": "^2.0.0" + }, + "funding": { + "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" } }, "node_modules/domelementtype": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.1.0.tgz", - "integrity": "sha512-LsTgx/L5VpD+Q8lmsXSHW2WpA+eBlZ9HPf3erD1IoPF00/3JKHZ3BknUVA2QGDNu69ZNmyFmCWBSO45XjYKC5w==" + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.2.0.tgz", + "integrity": "sha512-DtBMo82pv1dFtUmHyr48beiuq792Sxohr+8Hm9zoxklYPfa6n0Z3Byjj2IV7bmr2IyqClnqEQhfgHJJ5QF0R5A==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ] }, "node_modules/domexception": { "version": "2.0.1", @@ -299,24 +375,31 @@ } }, "node_modules/domhandler": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-4.0.0.tgz", - "integrity": "sha512-KPTbnGQ1JeEMQyO1iYXoagsI6so/C96HZiFyByU3T6iAzpXn8EGEvct6unm1ZGoed8ByO2oirxgwxBmqKF9haA==", + + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-4.2.0.tgz", + "integrity": "sha512-zk7sgt970kzPks2Bf+dwT/PLzghLnsivb9CcxkvR8Mzr66Olr0Ofd8neSbglHJHaHa2MadfoSdNlKYAaafmWfA==", "dependencies": { - "domelementtype": "^2.1.0" + "domelementtype": "^2.2.0" }, "engines": { "node": ">= 4" + }, + "funding": { + "url": "https://github.com/fb55/domhandler?sponsor=1" } }, "node_modules/domutils": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-2.5.0.tgz", - "integrity": "sha512-Ho16rzNMOFk2fPwChGh3D2D9OEHAfG19HgmRR2l+WLSsIstNsAYBzePH412bL0y5T44ejABIVfTHQ8nqi/tBCg==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-2.7.0.tgz", + "integrity": "sha512-8eaHa17IwJUPAiB+SoTYBo5mCdeMgdcAoXJ59m6DT1vw+5iLS3gNoqYaRowaBKtGVrOF1Jz4yDTgYKLK2kvfJg==", "dependencies": { "dom-serializer": "^1.0.1", - "domelementtype": "^2.0.1", - "domhandler": "^4.0.0" + "domelementtype": "^2.2.0", + "domhandler": "^4.2.0" + }, + "funding": { + "url": "https://github.com/fb55/domutils?sponsor=1" } }, "node_modules/ecc-jsbn": { @@ -554,13 +637,20 @@ } }, "node_modules/htmlparser2": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-6.0.1.tgz", - "integrity": "sha512-GDKPd+vk4jvSuvCbyuzx/unmXkk090Azec7LovXP8as1Hn8q9p3hbjmDGbUqqhknw0ajwit6LiiWqfiTUPMK7w==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-6.1.0.tgz", + "integrity": "sha512-gyyPk6rgonLFEDGoeRgQNaEUvdJ4ktTmmUh/h2t7s+M8oPpIPxgNACWa+6ESR57kXstwqPiCut0V8NRpcwgU7A==", + "funding": [ + "https://github.com/fb55/htmlparser2?sponsor=1", + { + "type": "github", + "url": "https://github.com/sponsors/fb55" + } + ], "dependencies": { "domelementtype": "^2.0.1", "domhandler": "^4.0.0", - "domutils": "^2.4.4", + "domutils": "^2.5.2", "entities": "^2.0.0" } }, @@ -758,6 +848,17 @@ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" }, + "node_modules/nth-check": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.0.0.tgz", + "integrity": "sha512-i4sc/Kj8htBrAiH1viZ0TgU8Y5XqCaV/FziYK6TBczxmeKm3AEFWqqF3195yKudrarqy7Zu80Ra5dobFjn9X/Q==", + "dependencies": { + "boolbase": "^1.0.0" + }, + "funding": { + "url": "https://github.com/fb55/nth-check?sponsor=1" + } + }, "node_modules/nwsapi": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.0.tgz", @@ -805,6 +906,14 @@ "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz", "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==" }, + "node_modules/parse5-htmlparser2-tree-adapter": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-6.0.1.tgz", + "integrity": "sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA==", + "dependencies": { + "parse5": "^6.0.1" + } + }, "node_modules/path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", @@ -933,7 +1042,6 @@ "engines": { "node": ">= 0.12" } - }, "node_modules/request/node_modules/tough-cookie": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", @@ -1037,6 +1145,11 @@ "node": ">=8" } }, + "node_modules/tslib": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", + "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==" + }, "node_modules/tunnel-agent": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", @@ -1298,6 +1411,11 @@ "tweetnacl": "^0.14.3" } }, + "boolbase": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", + "integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=" + }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -1317,6 +1435,32 @@ "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" }, + "cheerio": { + "version": "1.0.0-rc.10", + "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.10.tgz", + "integrity": "sha512-g0J0q/O6mW8z5zxQ3A8E8J1hUgp4SMOvEoW/x84OwyHKe/Zccz83PVT4y5Crcr530FV6NgmKI1qvGTKVl9XXVw==", + "requires": { + "cheerio-select": "^1.5.0", + "dom-serializer": "^1.3.2", + "domhandler": "^4.2.0", + "htmlparser2": "^6.1.0", + "parse5": "^6.0.1", + "parse5-htmlparser2-tree-adapter": "^6.0.1", + "tslib": "^2.2.0" + } + }, + "cheerio-select": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/cheerio-select/-/cheerio-select-1.5.0.tgz", + "integrity": "sha512-qocaHPv5ypefh6YNxvnbABM07KMxExbtbfuJoIie3iZXX1ERwYmJcIiRrr9H05ucQP1k28dav8rpdDgjQd8drg==", + "requires": { + "css-select": "^4.1.3", + "css-what": "^5.0.1", + "domelementtype": "^2.2.0", + "domhandler": "^4.2.0", + "domutils": "^2.7.0" + } + }, "combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -1340,6 +1484,23 @@ "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" }, + "css-select": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-4.1.3.tgz", + "integrity": "sha512-gT3wBNd9Nj49rAbmtFHj1cljIAOLYSX1nZ8CB7TBO3INYckygm5B7LISU/szY//YmdiSLbJvDLOx9VnMVpMBxA==", + "requires": { + "boolbase": "^1.0.0", + "css-what": "^5.0.0", + "domhandler": "^4.2.0", + "domutils": "^2.6.0", + "nth-check": "^2.0.0" + } + }, + "css-what": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/css-what/-/css-what-5.0.1.tgz", + "integrity": "sha512-FYDTSHb/7KXsWICVsxdmiExPjCfRC4qRFBdVwv7Ax9hMnvMmEjP9RfxTEZ3qPZGmADDn2vAKSo9UcN1jKVYscg==" + }, "cssom": { "version": "0.4.4", "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.4.4.tgz", @@ -1404,19 +1565,19 @@ "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" }, "dom-serializer": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.2.0.tgz", - "integrity": "sha512-n6kZFH/KlCrqs/1GHMOd5i2fd/beQHuehKdWvNNffbGHTr/almdhuVvTVFb3V7fglz+nC50fFusu3lY33h12pA==", + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.3.2.tgz", + "integrity": "sha512-5c54Bk5Dw4qAxNOI1pFEizPSjVsx5+bpJKmL2kPn8JhBUq2q09tTCa3mjijun2NfK78NMouDYNMBkOrPZiS+ig==", "requires": { "domelementtype": "^2.0.1", - "domhandler": "^4.0.0", + "domhandler": "^4.2.0", "entities": "^2.0.0" } }, "domelementtype": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.1.0.tgz", - "integrity": "sha512-LsTgx/L5VpD+Q8lmsXSHW2WpA+eBlZ9HPf3erD1IoPF00/3JKHZ3BknUVA2QGDNu69ZNmyFmCWBSO45XjYKC5w==" + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.2.0.tgz", + "integrity": "sha512-DtBMo82pv1dFtUmHyr48beiuq792Sxohr+8Hm9zoxklYPfa6n0Z3Byjj2IV7bmr2IyqClnqEQhfgHJJ5QF0R5A==" }, "domexception": { "version": "2.0.1", @@ -1434,21 +1595,21 @@ } }, "domhandler": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-4.0.0.tgz", - "integrity": "sha512-KPTbnGQ1JeEMQyO1iYXoagsI6so/C96HZiFyByU3T6iAzpXn8EGEvct6unm1ZGoed8ByO2oirxgwxBmqKF9haA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-4.2.0.tgz", + "integrity": "sha512-zk7sgt970kzPks2Bf+dwT/PLzghLnsivb9CcxkvR8Mzr66Olr0Ofd8neSbglHJHaHa2MadfoSdNlKYAaafmWfA==", "requires": { - "domelementtype": "^2.1.0" + "domelementtype": "^2.2.0" } }, "domutils": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-2.5.0.tgz", - "integrity": "sha512-Ho16rzNMOFk2fPwChGh3D2D9OEHAfG19HgmRR2l+WLSsIstNsAYBzePH412bL0y5T44ejABIVfTHQ8nqi/tBCg==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-2.7.0.tgz", + "integrity": "sha512-8eaHa17IwJUPAiB+SoTYBo5mCdeMgdcAoXJ59m6DT1vw+5iLS3gNoqYaRowaBKtGVrOF1Jz4yDTgYKLK2kvfJg==", "requires": { "dom-serializer": "^1.0.1", - "domelementtype": "^2.0.1", - "domhandler": "^4.0.0" + "domelementtype": "^2.2.0", + "domhandler": "^4.2.0" } }, "ecc-jsbn": { @@ -1625,13 +1786,13 @@ } }, "htmlparser2": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-6.0.1.tgz", - "integrity": "sha512-GDKPd+vk4jvSuvCbyuzx/unmXkk090Azec7LovXP8as1Hn8q9p3hbjmDGbUqqhknw0ajwit6LiiWqfiTUPMK7w==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-6.1.0.tgz", + "integrity": "sha512-gyyPk6rgonLFEDGoeRgQNaEUvdJ4ktTmmUh/h2t7s+M8oPpIPxgNACWa+6ESR57kXstwqPiCut0V8NRpcwgU7A==", "requires": { "domelementtype": "^2.0.1", "domhandler": "^4.0.0", - "domutils": "^2.4.4", + "domutils": "^2.5.2", "entities": "^2.0.0" } }, @@ -1801,6 +1962,14 @@ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==" }, + "nth-check": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.0.0.tgz", + "integrity": "sha512-i4sc/Kj8htBrAiH1viZ0TgU8Y5XqCaV/FziYK6TBczxmeKm3AEFWqqF3195yKudrarqy7Zu80Ra5dobFjn9X/Q==", + "requires": { + "boolbase": "^1.0.0" + } + }, "nwsapi": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.0.tgz", @@ -1842,6 +2011,14 @@ "resolved": "https://registry.npmjs.org/parse5/-/parse5-6.0.1.tgz", "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==" }, + "parse5-htmlparser2-tree-adapter": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-6.0.1.tgz", + "integrity": "sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA==", + "requires": { + "parse5": "^6.0.1" + } + }, "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", @@ -2027,6 +2204,11 @@ "punycode": "^2.1.1" } }, + "tslib": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", + "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==" + }, "tunnel-agent": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", diff --git a/package.json b/package.json index 9831d3d5..495c5f40 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "author": "Arhey", "license": "MIT", "dependencies": { + "cheerio": "^1.0.0-rc.10", "dayjs": "^1.10.4", "epg-grabber": "^0.6.6", "epg-parser": "^0.1.3", diff --git a/sites/albepg.com.channels.xml b/sites/albepg.com.channels.xml deleted file mode 100755 index 15864a2d..00000000 --- a/sites/albepg.com.channels.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - - 21 Junior - 21 Popullore - 24 Kitchen Srbija - 3 Plus - ABC News - AlbUK TV - Alsat - Animal Planet Europe - Arena Sport 1 - Arena Sport 2 - Arena Sport 3 - Arena Sport 4 - Arta - BBF Music TV - BabyTV Europe - Balkanika TV - Bang Bang - Boomerang EMEA - Click TV - Discovery Channel Bulgaria - Elrodi TV - Euronews Albania - Eurosport 1 - Explorer Histori - Explorer Natyra - Explorer Shkencë - Family HD - FashionTV Europe - Film Aksion - Film Drame - Film Dy HD - Film Hits - Film Hits +1 - Film Komedi - Film Një HD - Film Thriller - Folk+ - Fox Life Regional - Fox Srbija - In TV - Investigation Discovery Europe - Junior TV - Kanal 10 - Kanal D Drama - Kanali 7 - Klan Kosova - Klan Macedonia - Klan Plus - Kohavision - Living HD - MFM - MTV Live HD - Muse - My Music - National Geographic Channel HD Europe - Nesër TV - News 24 - On-TV - Ora News - Peace TV English - RTSH 1 - RTSH 2 - RTSH 3 - RTSH Agro - RTSH Femije - RTSH Film - RTSH Korca - RTSH Muzikë - RTSH Plus - RTSH Shkolle - RTSH Shqip - RTSH Sport - RTV21 - STV Folk - Stinët - Super Sonic TV - SuperSport 1 - SuperSport 2 - SuperSport 3 - SuperSport 4 - SuperSport 5 - SuperSport 6 - SuperSport Kosova 1 - SuperSport Kosova 2 - SuperSport Kosova 3 - T7 - TV 21 Macedonia - TV Klan - TV Koha - TV Shenja - TV Tetova - TVM2 - Telesport - Tip TV - Top Channel - Top News - Tribuna Channel - Tring Action - Tring Comedy - Tring Family - Tring Fantasy - Tring History - Tring International - Tring Jolly - Tring Kids - Tring Life - Tring Planet - Tring Shqip - Tring Smile - Tring Sport 1 - Tring Sport 2 - Tring Sport 3 - Tring Sport 4 - Tring Sport News - Tring Super - Tring Tring - Tring World - Vizion Plus - Çufo - - \ No newline at end of file diff --git a/sites/albepg.com.config.js b/sites/albepg.com.config.js deleted file mode 100644 index dcfe09fb..00000000 --- a/sites/albepg.com.config.js +++ /dev/null @@ -1,51 +0,0 @@ -const epgParser = require('epg-parser') -const dayjs = require('dayjs') -const utc = require('dayjs/plugin/utc') -const customParseFormat = require('dayjs/plugin/customParseFormat') - -dayjs.extend(utc) -dayjs.extend(customParseFormat) - -module.exports = { - lang: 'sq', - site: 'albepg.com', - channels: 'albepg.com.channels.xml', - output: '.gh-pages/guides/albepg.com.guide.xml', - request: { - timeout: 15000, - headers: { - Referer: 'http://albepg.com/epg.html' - } - }, - url: function () { - return `http://albepg.com/epg/guide.xml` - }, - logo: function ({ channel }) { - return `http://albepg.com/tvlogi/${channel.site_id}.png` - }, - parser: function ({ content, channel, date }) { - const results = epgParser.parse(content) - let programs = [] - results.programs - .filter(item => item.channel === channel.site_id) - .forEach(item => { - if (item.title.length && item.start && item.stop) { - const description = item.desc.length ? item.desc[0].value : null - const category = item.category.length ? item.category[0].value : null - const start = dayjs.utc(item.start, 'YYYYMMDDHHmmss Z') - const stop = dayjs.utc(item.stop, 'YYYYMMDDHHmmss Z') - if (start.diff(date.format('YYYY-MM-DD'), 'd') === 0) { - programs.push({ - title: item.title[0].value, - description, - category, - start: start.toString(), - stop: stop.toString() - }) - } - } - }) - - return programs - } -} diff --git a/sites/andorradifusio.ad.config.js b/sites/andorradifusio.ad.config.js index 476da9f6..175f4324 100644 --- a/sites/andorradifusio.ad.config.js +++ b/sites/andorradifusio.ad.config.js @@ -2,11 +2,14 @@ const jsdom = require('jsdom') const { JSDOM } = jsdom const dayjs = require('dayjs') const utc = require('dayjs/plugin/utc') +const timezone = require('dayjs/plugin/timezone') const customParseFormat = require('dayjs/plugin/customParseFormat') dayjs.extend(utc) +dayjs.extend(timezone) dayjs.extend(customParseFormat) +let PM = false module.exports = { lang: 'ca', site: 'andorradifusio.ad', @@ -16,36 +19,59 @@ module.exports = { return `https://www.andorradifusio.ad/programacio/${channel.site_id}` }, parser({ content, date }) { - const day = date.day() - 1 const programs = [] - const dom = new JSDOM(content) - const cols = dom.window.document.querySelectorAll('.programacio-dia') - const colNum = day < 0 ? 6 : day - const times = cols[colNum].querySelectorAll(`h4`) - const titles = cols[colNum].querySelectorAll(`p`) - - times.forEach((time, i) => { - const title = titles[i] ? titles[i].textContent : null - if (!time || !title) return false - - const start = dayjs - .utc(time.textContent, 'HH:mm') - .set('D', date.get('D')) - .set('M', date.get('M')) - .set('y', date.get('y')) - - if (!start.isValid()) return false - - if (programs.length && !programs[programs.length - 1].stop) { + const items = parseItems(content, date) + items.forEach(item => { + const title = parseTitle(item) + let start = parseStart(item, date) + if (start.hour() > 11) PM = true + if (start.hour() < 12 && PM) start = start.add(1, 'd') + const stop = parseStop(item, date) + if (programs.length) { programs[programs.length - 1].stop = start } programs.push({ title, - start + start, + stop }) }) return programs } } + +function parseStop(item, date) { + return date.tz('Europe/Madrid').endOf('d').add(6, 'h') +} + +function parseStart(item, date) { + let time = (item.time || { textContent: '' }).textContent + time = `${date.format('MM/DD/YYYY')} ${time}` + + return dayjs.tz(time, 'MM/DD/YYYY HH:mm', 'Europe/Madrid') +} + +function parseTitle(item) { + return (item.title || { textContent: '' }).textContent +} + +function parseItems(content, date) { + const items = [] + const dom = new JSDOM(content) + const day = date.day() - 1 + const colNum = day < 0 ? 6 : day + const cols = dom.window.document.querySelectorAll('.programacio-dia') + const col = cols[colNum] + const timeRows = col.querySelectorAll(`h4`) + const titleRows = col.querySelectorAll(`p`) + timeRows.forEach((time, i) => { + items.push({ + time, + title: titleRows[i] + }) + }) + + return items +} diff --git a/sites/comteco.com.bo.config.js b/sites/comteco.com.bo.config.js index 6def9c7a..021c913e 100644 --- a/sites/comteco.com.bo.config.js +++ b/sites/comteco.com.bo.config.js @@ -2,9 +2,11 @@ const jsdom = require('jsdom') const { JSDOM } = jsdom const dayjs = require('dayjs') const utc = require('dayjs/plugin/utc') +const timezone = require('dayjs/plugin/timezone') const customParseFormat = require('dayjs/plugin/customParseFormat') dayjs.extend(utc) +dayjs.extend(timezone) dayjs.extend(customParseFormat) module.exports = { @@ -25,38 +27,43 @@ module.exports = { }, parser: function ({ content, date }) { const programs = [] - const dom = new JSDOM(content) - const items = dom.window.document.querySelectorAll('#datosasociados > div > .list-group-item') + const items = parseItems(content) items.forEach(item => { - const time = ( - item.querySelector('div > div.col-xs-11 > p > span') || { textContent: '' } - ).textContent - .toString() - .trim() - const title = ( - item.querySelector('div > div.col-xs-11 > p > strong') || { textContent: '' } - ).textContent - .toString() - .trim() - - if (time && title) { - const start = dayjs - .utc(time, 'HH:mm:ss') - .set('D', date.get('D')) - .set('M', date.get('M')) - .set('y', date.get('y')) - - if (programs.length && !programs[programs.length - 1].stop) { - programs[programs.length - 1].stop = start - } - - programs.push({ - title, - start: start.toString() - }) + const title = parseTitle(item) + let start = parseStart(item, date) + const stop = parseStop(item, date) + if (programs.length) { + programs[programs.length - 1].stop = start } + + programs.push({ title, start, stop }) }) return programs } } + +function parseStop(item, date) { + return date.tz('America/La_Paz').endOf('d') +} + +function parseStart(item, date) { + let time = ( + item.querySelector('div > div.col-xs-11 > p > span') || { textContent: '' } + ).textContent.trim() + time = `${date.format('MM/DD/YYYY')} ${time}` + + return dayjs.tz(time, 'MM/DD/YYYY HH:mm:ss', 'America/La_Paz') +} + +function parseTitle(item) { + return ( + item.querySelector('div > div.col-xs-11 > p > strong') || { textContent: '' } + ).textContent.trim() +} + +function parseItems(content) { + const dom = new JSDOM(content) + + return dom.window.document.querySelectorAll('#datosasociados > div > .list-group-item') +} diff --git a/sites/hd-plus.de.config.js b/sites/hd-plus.de.config.js index 2ad6cc01..e69ec966 100644 --- a/sites/hd-plus.de.config.js +++ b/sites/hd-plus.de.config.js @@ -2,12 +2,12 @@ const jsdom = require('jsdom') const { JSDOM } = jsdom const dayjs = require('dayjs') const utc = require('dayjs/plugin/utc') -const customParseFormat = require('dayjs/plugin/customParseFormat') const timezone = require('dayjs/plugin/timezone') +const customParseFormat = require('dayjs/plugin/customParseFormat') dayjs.extend(utc) -dayjs.extend(customParseFormat) dayjs.extend(timezone) +dayjs.extend(customParseFormat) module.exports = { lang: 'de', @@ -26,29 +26,42 @@ module.exports = { return img ? img.src : null }, - parser({ content }) { - const dom = new JSDOM(content) - const items = dom.window.document.querySelectorAll('table > tbody > tr') - let programs = [] + parser({ content, date }) { + const programs = [] + const items = parseItems(content) items.forEach(item => { - const title = (item.querySelector('td:nth-child(1) > a') || { textContent: '' }).textContent - const fullDate = (item.querySelector('td:nth-child(2)') || { textContent: '' }).textContent - if (title && fullDate) { - const time = fullDate.split(' ').pop() - const local = dayjs.utc(time, 'HH:mm').toString() - const start = dayjs.tz(local.toString(), 'Europe/Berlin').toString() - - if (programs.length && !programs[programs.length - 1].stop) { - programs[programs.length - 1].stop = start - } - - programs.push({ - title, - start - }) + const title = parseTitle(item) + let start = parseStart(item, date) + const stop = parseStop(item, date) + if (programs.length) { + programs[programs.length - 1].stop = start } + + programs.push({ title, start, stop }) }) return programs } } + +function parseStop(item, date) { + return date.endOf('d') +} + +function parseStart(item, date) { + let time = (item.querySelector('td:nth-child(2)') || { textContent: '' }).textContent + time = time.split(' ').pop() + time = `${date.format('MM/DD/YYYY')} ${time}` + + return dayjs.tz(time, 'MM/DD/YYYY HH:mm', 'Europe/Berlin') +} + +function parseTitle(item) { + return (item.querySelector('td:nth-child(1) > a') || { textContent: '' }).textContent +} + +function parseItems(content) { + const dom = new JSDOM(content) + + return dom.window.document.querySelectorAll('table > tbody > tr') +} diff --git a/sites/m.tv.sms.cz.config.js b/sites/m.tv.sms.cz.config.js index cef55833..e820ef0d 100644 --- a/sites/m.tv.sms.cz.config.js +++ b/sites/m.tv.sms.cz.config.js @@ -3,13 +3,14 @@ const iconv = require('iconv-lite') const { JSDOM } = jsdom const dayjs = require('dayjs') const utc = require('dayjs/plugin/utc') -var customParseFormat = require('dayjs/plugin/customParseFormat') -var timezone = require('dayjs/plugin/timezone') +const timezone = require('dayjs/plugin/timezone') +const customParseFormat = require('dayjs/plugin/customParseFormat') dayjs.extend(utc) -dayjs.extend(customParseFormat) dayjs.extend(timezone) +dayjs.extend(customParseFormat) +let PM = false module.exports = { lang: 'cs', site: 'm.tv.sms.cz', @@ -28,40 +29,53 @@ module.exports = { }, parser: function ({ buffer, date }) { const programs = [] - const string = iconv.decode(buffer, 'win1250') - const dom = new JSDOM(string) - const items = dom.window.document.querySelectorAll('#obsah > div > div.porady > div.porad') + const items = parseItems(buffer) items.forEach((item, i) => { - const time = (item.querySelector('div > span') || { textContent: '' }).textContent - .toString() - .trim() - const title = (item.querySelector('a > div') || { textContent: '' }).textContent - .toString() - .trim() - const description = (item.querySelector('a > div.detail') || { textContent: '' }).textContent - .toString() - .trim() - - if (time && title) { - let local = dayjs.utc(time, 'HH.mm').date(date.date()).month(date.month()).year(date.year()) - - if (local.hour() <= 6 && i > items.length / 2) { - local = local.date(local.date() + 1) - } - const start = dayjs.tz(local.toString(), 'Europe/Prague').toString() - - if (programs.length && !programs[programs.length - 1].stop) { - programs[programs.length - 1].stop = start - } - - programs.push({ - title, - description, - start - }) + const title = parseTitle(item) + const description = parseDescription(item) + let start = parseStart(item, date) + if (start.hour() > 11) PM = true + if (start.hour() < 12 && PM) start = start.add(1, 'd') + const stop = parseStop(item, date) + if (programs.length) { + programs[programs.length - 1].stop = start } + + programs.push({ + title, + description, + start, + stop + }) }) return programs } } + +function parseStop(item, date) { + return date.tz('Europe/Prague').endOf('d').add(6, 'h') +} + +function parseStart(item, date) { + let time = (item.querySelector('div > span') || { textContent: '' }).textContent.trim() + + time = `${date.format('MM/DD/YYYY')} ${time}` + + return dayjs.tz(time, 'MM/DD/YYYY HH.mm', 'Europe/Prague') +} + +function parseDescription(item) { + return (item.querySelector('a > div.detail') || { textContent: '' }).textContent.trim() +} + +function parseTitle(item) { + return (item.querySelector('a > div') || { textContent: '' }).textContent.trim() +} + +function parseItems(buffer) { + const string = iconv.decode(buffer, 'win1250') + const dom = new JSDOM(string) + + return dom.window.document.querySelectorAll('#obsah > div > div.porady > div.porad') +} diff --git a/sites/meo.pt.channels.xml b/sites/meo.pt.channels.xml index 8b41aff9..9a55f5d8 100755 --- a/sites/meo.pt.channels.xml +++ b/sites/meo.pt.channels.xml @@ -114,5 +114,9 @@ i24 News English i24 News Français Первый канал + TVCine Top + TVCine Edition + TVCine Emotion + TVCine Action \ No newline at end of file diff --git a/sites/mi.tv.config.js b/sites/mi.tv.config.js index 94cdfbe7..27820789 100644 --- a/sites/mi.tv.config.js +++ b/sites/mi.tv.config.js @@ -2,11 +2,14 @@ const jsdom = require('jsdom') const { JSDOM } = jsdom const dayjs = require('dayjs') const utc = require('dayjs/plugin/utc') +const timezone = require('dayjs/plugin/timezone') const customParseFormat = require('dayjs/plugin/customParseFormat') dayjs.extend(utc) +dayjs.extend(timezone) dayjs.extend(customParseFormat) +let PM = false module.exports = { lang: 'pt', site: 'mi.tv', @@ -23,32 +26,48 @@ module.exports = { }, parser({ content, date }) { const programs = [] - const dom = new JSDOM(content) - const items = dom.window.document.querySelectorAll('#listings > ul > li') + const items = parseItems(content) items.forEach(item => { - const title = (item.querySelector('a > div.content > h2') || { textContent: '' }).textContent - const time = (item.querySelector('a > div.content > span.time') || { textContent: '' }) - .textContent - - if (title && time) { - const start = dayjs - .utc(time, 'HH:mm') - .set('D', date.get('D')) - .set('M', date.get('M')) - .set('y', date.get('y')) - - if (programs.length && !programs[programs.length - 1].stop) { - programs[programs.length - 1].stop = start - } - - programs.push({ - title, - start - }) + const title = parseTitle(item) + let start = parseStart(item, date) + if (!start) return + if (start.hour() > 11) PM = true + if (start.hour() < 12 && PM) start = start.add(1, 'd') + const stop = parseStop(item, start) + if (programs.length) { + programs[programs.length - 1].stop = start } + + programs.push({ + title, + start, + stop + }) }) return programs } } + +function parseStop(item, date) { + return date.endOf('d').add(6, 'h') +} + +function parseStart(item, date) { + let time = (item.querySelector('a > div.content > span.time') || { textContent: '' }).textContent + if (!time) return null + time = `${date.format('MM/DD/YYYY')} ${time}` + + return dayjs.tz(time, 'MM/DD/YYYY HH:mm', 'America/Sao_Paulo') +} + +function parseTitle(item) { + return (item.querySelector('a > div.content > h2') || { textContent: '' }).textContent +} + +function parseItems(content) { + const dom = new JSDOM(content) + + return dom.window.document.querySelectorAll('#listings > ul > li') +} diff --git a/sites/ontvtonight.com.config.js b/sites/ontvtonight.com.config.js index 544f0953..07f10f08 100644 --- a/sites/ontvtonight.com.config.js +++ b/sites/ontvtonight.com.config.js @@ -2,9 +2,11 @@ const jsdom = require('jsdom') const { JSDOM } = jsdom const dayjs = require('dayjs') const utc = require('dayjs/plugin/utc') -var customParseFormat = require('dayjs/plugin/customParseFormat') +const timezone = require('dayjs/plugin/timezone') +const customParseFormat = require('dayjs/plugin/customParseFormat') dayjs.extend(utc) +dayjs.extend(timezone) dayjs.extend(customParseFormat) module.exports = { @@ -32,36 +34,21 @@ module.exports = { }, parser: function ({ content, date }) { const programs = [] - const dom = new JSDOM(content) - const items = dom.window.document.querySelectorAll( - '#content > div > div > div.span6 > table > tbody > tr' - ) - + const items = parseItems(content) items.forEach(item => { - const time = (item.querySelector('td:nth-child(1) > h5') || { textContent: '' }).textContent - .toString() - .trim() - const title = ( - item.querySelector('td:nth-child(2) > h5 > a') || { textContent: '' } - ).textContent - .toString() - .trim() + const title = parseTitle(item) + const start = parseStart(item, date) + const stop = parseStop(item, date) - if (time && title) { - const start = dayjs - .utc(time, 'h:mma') - .set('D', date.get('D')) - .set('M', date.get('M')) - .set('y', date.get('y')) - .toString() - - if (programs.length && !programs[programs.length - 1].stop) { + if (title && start) { + if (programs.length) { programs[programs.length - 1].stop = start } programs.push({ title, - start + start, + stop }) } }) @@ -69,3 +56,28 @@ module.exports = { return programs } } + +function parseStop(item, date) { + return date.tz('Europe/London').endOf('d') +} + +function parseStart(item, date) { + let time = (item.querySelector('td:nth-child(1) > h5') || { textContent: '' }).textContent.trim() + time = `${date.format('DD/MM/YYYY')} ${time.toUpperCase()}` + + return dayjs.tz(time, 'DD/MM/YYYY H:mm A', 'Europe/London') +} + +function parseTitle(item) { + return (item.querySelector('td:nth-child(2) > h5 > a') || { textContent: '' }).textContent + .toString() + .trim() +} + +function parseItems(content) { + const dom = new JSDOM(content) + + return dom.window.document.querySelectorAll( + '#content > div > div > div.span6 > table > tbody > tr' + ) +} diff --git a/sites/programtv.onet.pl.config.js b/sites/programtv.onet.pl.config.js index 9c4baf6c..19e61d8a 100644 --- a/sites/programtv.onet.pl.config.js +++ b/sites/programtv.onet.pl.config.js @@ -2,11 +2,14 @@ const jsdom = require('jsdom') const { JSDOM } = jsdom const dayjs = require('dayjs') const utc = require('dayjs/plugin/utc') +const timezone = require('dayjs/plugin/timezone') const customParseFormat = require('dayjs/plugin/customParseFormat') dayjs.extend(utc) +dayjs.extend(timezone) dayjs.extend(customParseFormat) +let PM = false module.exports = { lang: 'pl', site: 'programtv.onet.pl', @@ -24,24 +27,16 @@ module.exports = { }, parser: function ({ content, date }) { const programs = [] - const dom = new JSDOM(content) - const items = dom.window.document.querySelectorAll( - '#channelTV > section > div.emissions > ul > li' - ) - + const items = parseItems(content) items.forEach(item => { - const title = (item.querySelector('.titles > a') || { textContent: '' }).textContent - const description = (item.querySelector('.titles > p') || { textContent: '' }).textContent - const category = (item.querySelector('.titles > .type') || { textContent: '' }).textContent - const hour = (item.querySelector('.hours > .hour') || { textContent: '' }).textContent - - const start = dayjs - .utc(hour, 'H:mm') - .set('D', date.get('D')) - .set('M', date.get('M')) - .set('y', date.get('y')) - - if (programs.length && !programs[programs.length - 1].stop) { + const title = parseTitle(item) + const description = parseDescription(item) + const category = parseCategory(item) + let start = parseStart(item, date) + if (start.hour() > 11) PM = true + if (start.hour() < 12 && PM) start = start.add(1, 'd') + const stop = parseStop(item, date) + if (programs.length) { programs[programs.length - 1].stop = start } @@ -49,10 +44,40 @@ module.exports = { title, description, category, - start + start, + stop }) }) return programs } } + +function parseStop(item, date) { + return date.add(1, 'd').hour(3).startOf('h') +} + +function parseStart(item, date) { + let time = (item.querySelector('.hours > .hour') || { textContent: '' }).textContent + time = `${date.format('MM/DD/YYYY')} ${time}` + + return dayjs.tz(time, 'MM/DD/YYYY HH:mm', 'Europe/Warsaw') +} + +function parseCategory(item) { + return (item.querySelector('.titles > .type') || { textContent: '' }).textContent +} + +function parseDescription(item) { + return (item.querySelector('.titles > p') || { textContent: '' }).textContent +} + +function parseTitle(item) { + return (item.querySelector('.titles > a') || { textContent: '' }).textContent +} + +function parseItems(content) { + const dom = new JSDOM(content) + + return dom.window.document.querySelectorAll('#channelTV > section > div.emissions > ul > li') +} diff --git a/sites/tvgid.ua.config.js b/sites/tvgid.ua.config.js index 511dbb6b..b54fca8a 100644 --- a/sites/tvgid.ua.config.js +++ b/sites/tvgid.ua.config.js @@ -3,11 +3,14 @@ const iconv = require('iconv-lite') const { JSDOM } = jsdom const dayjs = require('dayjs') const utc = require('dayjs/plugin/utc') +const timezone = require('dayjs/plugin/timezone') const customParseFormat = require('dayjs/plugin/customParseFormat') dayjs.extend(utc) +dayjs.extend(timezone) dayjs.extend(customParseFormat) +let PM = false module.exports = { lang: 'uk', site: 'tvgid.ua', @@ -18,36 +21,50 @@ module.exports = { }, parser: function ({ buffer, date }) { const programs = [] - const string = iconv.decode(buffer, 'win1251') - const dom = new JSDOM(string) - const items = dom.window.document.querySelectorAll( - '#container > tbody > tr:nth-child(2) > td > table > tbody > tr > td > table:nth-child(2) > tbody > tr' - ) - + const items = parseItems(buffer) items.forEach(item => { - const time = (item.querySelector('td > table > tbody > tr > td.time') || { textContent: '' }) - .textContent - const title = ( - item.querySelector('td > table > tbody > tr > td.item > a') || - item.querySelector('td > table > tbody > tr > td.item') || { textContent: '' } - ).textContent - - const start = dayjs - .utc(time, 'HH:mm') - .set('D', date.get('D')) - .set('M', date.get('M')) - .set('y', date.get('y')) - - if (programs.length && !programs[programs.length - 1].stop) { + const title = parseTitle(item) + let start = parseStart(item, date) + if (!start) return + if (start.hour() > 11) PM = true + if (start.hour() < 12 && PM) start = start.add(1, 'd') + const stop = parseStop(item, start) + if (programs.length) { programs[programs.length - 1].stop = start } - programs.push({ - title, - start - }) + programs.push({ title, start, stop }) }) return programs } } + +function parseStop(item, date) { + return date.hour(7) +} + +function parseStart(item, date) { + let time = (item.querySelector('td > table > tbody > tr > td.time') || { textContent: '' }) + .textContent + if (!time) return null + time = `${date.format('MM/DD/YYYY')} ${time}` + + return dayjs.tz(time, 'MM/DD/YYYY HH:mm', 'Europe/Kiev') +} + +function parseTitle(item) { + return ( + item.querySelector('td > table > tbody > tr > td.item > a') || + item.querySelector('td > table > tbody > tr > td.item') || { textContent: '' } + ).textContent +} + +function parseItems(buffer) { + const string = iconv.decode(buffer, 'win1251') + const dom = new JSDOM(string) + + return dom.window.document.querySelectorAll( + '#container > tbody > tr:nth-child(2) > td > table > tbody > tr > td > table:nth-child(2) > tbody > tr:not(:first-child)' + ) +} diff --git a/sites/tvguide.com.channels.xml b/sites/tvguide.com.channels.xml new file mode 100755 index 00000000..5ad87d8e --- /dev/null +++ b/sites/tvguide.com.channels.xml @@ -0,0 +1,93 @@ + + + + A&E East + ABC East + AMC East + Animal Planet East + BBC America East + BET East + Bravo East + Cartoon Network East + CBS East + Cinemax East + CMT East + CNBC US + CNN USA + Comedy Central East + Discovery Channel East + Discovery Life Channel + Disney Channel East + Disney XD East + DIY Network USA + E! East + ESPN + ESPN 2 US + ESPN Classic USA + ESPNU + Flix East + Food Network East + Fox East + Fox News Channel + Fox Sports 1 + Freeform East + Fuse East + FX East + FX Movie Channel + FXX East + FYI East + Game Show Network East + Golf Channel US + Hallmark Channel East + HBO 2 East + HBO East + HBO Signature East + HGTV East + History East + IFC East + Investigation Discovery East + ION TV East + Lifetime East + Lifetime Movies East + Lifetime Real Women + MoreMax East + MSNBC + MTV East + MyNetworkTV + National Geographic East + NBC East + NBCSN + NewsNation East + Nickelodeon East + Oprah Winfrey Network East + Oxygen East + Paramount Network East + PBS East + Pop East + QVC US + Reelz + Science + Showtime 2 East + Showtime East + Smithsonian Channel East + Starz East + Starz Encore East + Sundance TV East + Syfy East + TBS East + TCM US + Telemundo Este + The CW East + The Movie Channel East + TLC East + TNT East + Travel Channel East + truTV East + TV Land East + TVG + Univisión East + USA Network East + VH1 East + We TV East + + \ No newline at end of file diff --git a/sites/tvguide.com.config.js b/sites/tvguide.com.config.js new file mode 100644 index 00000000..f6c13ac1 --- /dev/null +++ b/sites/tvguide.com.config.js @@ -0,0 +1,47 @@ +const dayjs = require('dayjs') +const utc = require('dayjs/plugin/utc') +const timezone = require('dayjs/plugin/timezone') + +dayjs.extend(utc) +dayjs.extend(timezone) + +module.exports = { + lang: 'en', + site: 'tvguide.com', + channels: 'tvguide.com.channels.xml', + output: '.gh-pages/guides/tvguide.com.guide.xml', + url: function ({ date, channel }) { + const localTime = date.tz('America/New_York') + const parts = channel.site_id.split('#') + const start = localTime.startOf('d') + const duration = localTime.endOf('d').diff(start, 'm') + const url = `https://cmg-prod.apigee.net/v1/xapi/tvschedules/tvguide/${ + parts[0] + }/web?start=${start.unix()}&duration=${duration}&channelSourceIds=${parts[1]}` + + return url + }, + parser: function ({ content }) { + const programs = [] + const items = parseItems(content) + items.forEach(item => { + programs.push({ + title: item.title, + start: parseTime(item.startTime), + stop: parseTime(item.endTime) + }) + }) + + return programs + } +} + +function parseTime(timestamp) { + return dayjs.unix(timestamp) +} + +function parseItems(content) { + const json = JSON.parse(content) + + return json.data.items[0].programSchedules +} diff --git a/sites/tvprofil.com.channels.xml b/sites/tvprofil.com.channels.xml new file mode 100755 index 00000000..3aecaecc --- /dev/null +++ b/sites/tvprofil.com.channels.xml @@ -0,0 +1,1430 @@ + + + + 13 + 13 Ulica + 13th Street Deutschland + 20 Mediaset + 24 Kitchen Bulgaria + 24 Kitchen Srbija + 24 Kitchen Türkiye + 24 TV + 3 Plus + 3+ + 360 Tune Box + 3sat + 4+ + 4Fun Dance + 4Fun Kids + 4Fun.TV + 4Music + 4seven + 5 Select + 5+ + 5Star + 5USA + 6+ + 6ter + A Haber + A News + A Para + A Spor + A2 + AB3 + Action+ + Active Family + Adventure + Agro TV + Agro TV + Al Jazeera Balkans + Al Jazeera English + Alfa TV + Alfa TV + Alibi UK + Alpha TV + Alsat + AMC Balkan + AMC Central Europe + AMC Magyarország + AMC Polska + Animal Planet Germany + Animal Planet Polska + Animal Planet Polska + Animal Planet UK + Animal Planet Россия + Anixe HD + Ant1 Europe + Antena 3 + Antena HD + Apostol TV + ARD Alpha + Arena Esport + Arena Fight + Arena Sport 1 + Arena Sport 1 BiH + Arena Sport 1 Hrvatska + Arena Sport 10 Hrvatska + Arena Sport 2 + Arena Sport 2 Hrvatska + Arena Sport 3 + Arena Sport 3 Hrvatska + Arena Sport 4 Hrvatska + Arena Sport 4 Hrvatska + Arena Sport 5 Hrvatska + Arena Sport 5 Hrvatska + Arena Sport 6 Hrvatska + Arena Sport 7 Hrvatska + Arena Sport 8 Hrvatska + Arena Sport 9 Hrvatska + Arena4 + ARTE Deutsch + ARTE Français + At The Races + ATV + ATV + ATV + ATV Avrupa + ATV Türkiye + ATV2 + Aurora TV + Auto Motor und Sport + AXN Adria + AXN Black + AXN Black Polska + AXN Bulgaria + AXN Central Europe + AXN España + AXN Polska + AXN Spin Adria + AXN Spin Polska + AXN White + AXN White España + AXN White Polska + B1 + B1B Box + B92 + BabyTV Español + BabyTV Europe + Balkan Trip + Balkanika TV + Bang Bang + Barely Legal TV + Bayern 3 + BBC Alba + BBC Brit Polska + BBC Earth Polska + BBC Earth Romania + BBC Earth Türkiye + BBC First Polska + BBC Four + BBC Lifestyle Polska + BBC News + BBC One + BBC One Northern Ireland + BBC One Scotland + BBC Parliament + BBC Two + BBC World News + BBN Türk + BDC TV + Behar TV + beIN Sports 1 + beIN Sports 1 France + beIN Sports 11 + beIN Sports 2 + beIN Sports 2 France + beIN Sports 2 France + beIN Sports 3 + beIN Sports 4 + beIN Sports 5 + beIN Sports 6 + beIN Sports 7 + beIN Sports NBA + Beyaz TV + BG Music Channel + BG-DNES + BHT1 + Bir TV + Bit TV + Bloomberg HT + Bloomberg TV Bulgaria + Bloomberg TV Europe + Blue Hustler Europe + BN 2 + BN Music + BN TV + Boing España + Boing France + Bollywood TV Romania + Bon Gusto + Boomerang Central & Eastern Europe + Boomerang Deutschland + Boomerang Italia + Boomerang Türkiye + Box TV + Brainz TV + Brazzers TV Europe + Brio + British Eurosport 1 + British Eurosport 2 + BT Sport 1 + BT Sport 2 + BT Sport 3 + BT Sport ESPN + bTV + bTV Action + bTV Cinema + bTV Comedy + bTV Comedy + bTV Lady + Bulgaria on Air + C8 + Caccia + Calle 13 + Canal 24 horas + Canal Cocina + Canal Hollywood España + Canal J + Canal Panda España + CANAL+ Cinema + CANAL+ Dokument + CANAL+ Family + CANAL+ Family + CANAL+ Family + CANAL+ France + CANAL+ Premium + CANAL+ Seriale + CANAL+ Series + CANAL+ Sport + CANAL+ Sport 2 Polska + CANAL+ Sport Polska + Canale 5 + Capital Xtra + Cartoon Network Central & Eastern Europe + Cartoon Network Italia + Cartoon Network Polska + Cartoon Network Türkiye + Cartoon Network UK + Cartoonito Italia + Cartoonito UK + CBBC + CBeebies Polska + CBeebies UK + CBS Drama UK + CBS Europa + CBS Justice UK + CBS Reality Europe + CBS Reality Polska + CBS Reality UK + CCTV 4 Europe + Cero + CGTN + CGTN Documentary + Challenge UK + Channel 4 UK + Channel 4 UK +1 + Channel 5 + Channel S + Chérie 25 + Cielo + CINE+ Premier + Cine34 + Cinema TV + Cinema+ + Cinemania + Cinemax 2 Central Europe + Cinemax Central Europe + CineStar TV 1 Hrvatska + CineStar TV 1 Srbija + CineStar TV 2 Hrvatska + CineStar TV Action Hrvatska + CineStar TV Action Srbija + CineStar TV Comedy + CineStar TV Fantasy + CineStar TV Premiere 1 + CineStar TV Premiere 2 + CITV + City TV + Clan TVE + Class TV Moda + Club MTV + Club RTL + Clubland TV + CMC TV + CNN International Europe + CNN Türk + Comedy Central Deutschland + Comedy Central España + Comedy Central España + Comedy Central Extra UK + Comedy Central Family Hungary + Comedy Central Hungary + Comedy Central Hungary + Comedy Central Italia + Comedy Central Polska + Comedy Central UK + Cool TV + Cosmopolitan TV España + Create and Craft TV + Crime & Investigation Italia + Crime & Investigation Polsat + Crime & Investigation UK + Crime & Investigation UK + Crimen & Investigación + CStar + Cuatro + D1 TV + Da Vinci + Da Vinci Polska + Das Erste + Dave UK + Daystar + DeA Junior + DeA Kids + Decasa + Deluxe Music + Dexy TV + Dečija TV + Diadora TV + Diema + Diema Family + Diema Family + Diema Sport + Diema Sport 2 + Digi Animal World + Digi Life Hungary + Digi Sport 1 Hungary + Digi Sport 1 Hungary + Digi Sport 3 Hungary + Digi World Hungary + Disco Polo Music + Discovery Channel Deutschland + Discovery Channel en Español + Discovery Channel Europe + Discovery Channel Hungary + Discovery Channel Italia + Discovery Channel Polska + Discovery Channel Türkiye + Discovery Channel UK + Discovery Science + Discovery Science Italia + Discovery Science UK + Discovery Turbo UK + Disney Channel Bulgaria + Disney Channel Deutschland + Disney Channel España + Disney Channel Hungary & Czechia + Disney Channel Romania + Disney Channel Türkiye + Disney Junior Deutschland + Disney Junior España + Disney Junior Romania & Bulgaria + Disney XD Polska + Divinity + Diyanet TV + Diyanet TV + DiziSmart Max + DM Sat + DMAX Deutschland + DMAX España + DMAX Italia + DMAX Türkiye + DMAX UK + DMC + DocuBox HD + Doku TV + Doma TV + Dorcel TV + Dorcel XXX + Dox TV + Dr. Fit Channel + Drama UK + Dream Türk + DSTV + DTX East Europe + Dubrovačka TV + Duck TV HD + Duna TV + Duna World + Dusk! + DW English + E! Deutschland + E! Europe + E4 UK + Eden + Eir Sport 1 + EKids + Eleven Sports 1 Polska + Eleven Sports 2 Polska + Eleven Sports 3 Polska + Eleven Sports 4 Polska + Elta 1 HD + Energy + English Club TV + Epic Drama + Epic Drama Polska + Erox HD + Eroxxx HD + Eska Rock TV + Eska TV + Eska TV Extra + ETV HD + Euro D + Eurochannel + Euronews Albania + Eurosport 1 + Eurosport 1 + Eurosport 1 España + Eurosport 1 France + Eurosport 1 Germany + Eurosport 1 Italia + Eurosport 1 Polska + Eurosport 2 + Eurosport 2 + Eurosport 2 España + Eurosport 2 France + Eurosport 2 Italia + Eurosport 2 Polska + Evrokom + EWTN Europe + Exodus TV + Explorer Histori + Explorer Natyra + Explorer Shkencë + Extreme Sports Channel + Extreme Sports Channel Polska + F+ + Face TV + FashionBox HD + FashionTV Europe + Fast&Fun Box HD + FB TV + FDF + Federalna TV + Fehérvár TV + FEM3 + Fen Folk + Fen TV + Fight Channel + Fight Klub + Fight Network + FightBox HD + Film 4 UK + Film Aksion + Film Café Hungary + Film Drame + Film Dy HD + Film Hits + Film Klub + Film Klub Extra + Film Komedi + Film Mánia + Film Një HD + Film Now Hungary + Film Thriller + Film+ Hungary + Film4 + FilmBox Action + FilmBox Arthouse Worldwide + FilmBox Extra HD Polska + FilmBox Premium Polska + FilmBox Stars Adria + FilmBox Stars Hungary + FilmBox Türkiye + Fix & Foxi + Focus + Fokus TV + Folklor TV + Food Network EMEA + Food Network Polska + Food Network UK + Forces TV + Fox Bulgaria + Fox Comedy Polska + Fox Crime Adria + Fox Crime Srbija + Fox Crime Türkiye + Fox Deutschland + Fox España + Fox Italia + Fox Life Bulgaria + Fox Life España + Fox Life Regional + Fox Life Srbija + Fox Movies Srbija + Fox News + Fox Polska + Fox Srbija + Fox Türkiye + France 2 + France 24 Arabic + France 24 English + France 24 Français + France 3 + France 4 + France 5 + Franceinfo + FreeSports + Frisbee + Fuel TV + FX Türkiye + Galaxy4 + Galicia TV Europa + Gambero Rosso + GameHub + Gametoon + Gea TV + Gems TV + Giallo TV + Ginx eSports TV International + Gold UK + Gold UK + Golf Channel Polska + Golica TV + Grand TV + GTV + Gulli + Gyöngyösi TV + H!T Music Channel Hungary + Ha Ha + Haber Global + Habertürk TV + Happy + Hayat + Hayat Folk + Hayat Music + Hayat Plus + Hayatovci + HBO Adria + HBO Hungary + HBO Polska + HBO2 Central Europe + HBO2 Polska + HBO3 Central Europe + HBO3 Polska + Heimatkanal + HGTV Polska + HGTV UK + HGTV UK + Hispan TV + History 2 Polska + History 2 Polska + History Deutschland + History en Español + History Europe + History Italia + History Polska + HNTV + Hobby TV + Horror Channel UK + HR Fernsehen + HRT 1 + HRT 2 + HRT 3 + HRT 4 + HRT International + HSE24 + HSE24 Extra + HSE24 Trend + Hustler TV Europe + Hír TV + Iberalia TV + Ideal World + IDJ TV + Imperia TV + In TV + Inspiration TV + Inter TV + Investigation Discovery Europe + Investigation Discovery Polska + Investigation Discovery UK + Iris + Italia 1 + Italia 2 + ITV 2 +1 + ITV Be + ITV Channel TV + ITV2 + ITV3 + ITV4 + iTVN Europe + iTVN Extra + Izaura TV + Izvorna TV + Jabuka TV + JimJam Europe + JimJam Polsat + JML Direct TV + Jocky TV + Jolly HD + Jugoton TV + K2 + K::CN 1 + K::CN 2 Music + K::CN Svet+ 3 + Kabel Eins Austria + Kabel Eins Classics + Kabel Eins Doku Austria + Kanal 1 + Kanal 5 + Kanal 6 + Kanal 7 + Kanal 9 + Kanal A + Kanal D + Kanal Ri + Ketchup TV + KiKA + Kino + Kino Nova + Kino Polska + Kino Polska Muzyka + Kino TV + Kino TV + Kinowelt TV + Kiss TV + Kitchen TV + Klan Kosova + Klan Macedonia + Klan Plus + Klape i Tambure + Klasik TV + Kohavision + Kral Pop TV + Kreator TV + KTV Ormož + Kuchnia+ + Kurir TV + La 1 + La 1 Catalunya + La 2 + La Sexta + La5 + La7 + La7d + Laeffe + Laudato TV + Lazio Style Channel + LCI + Libertas TV + Life TV + Lifetime Polska + Living HD + Lol + London Live + Lov i ribolov + M1 + M1 Film + M1 Gold + M2 + M3 + M4 + M5 + M6 + Magic TV + Magic TV + Max Sport 1 + Max Sport 2 + Max Sport 3 + Max Sport 4 + MCM France + MDR + Mediaset Extra + Mediaset Italia + Metro + Mezzo + Mezzo Live HD + Milan TV + Mini TV + minikaGO + Minimax Romania + MiniMini+ + More4 UK + Motor Trend + Motorvision TV + Motowizja + Movie Generation TV + Movie Star + Movies 24 + MovieSmart Classic + MovieSmart Premium + MovieSmart Premium 2 + MovieSmart Türk + Movistar Acción + Movistar Cine Español + Movistar Comedia + Movistar Deportes + Movistar Deportes 2 + Movistar Drama + Movistar Estrenos + Movistar F1 + Movistar Golf + Movistar Series + Movistar Series Xtra + Mozi+ + Moziverzum + Mreža TV + Mreža TV + MRT 1 + MRT 2 + MRT 3 + MRT 4 + MTV 80s + MTV 90s + MTV Base UK + MTV Classic UK + MTV Europe + MTV Germany + MTV Hits Europe + MTV Hits UK + MTV Hungary + MTV Igman + MTV Italia + MTV Live HD + MTV Music Italia + MTV Music Polska + MTV Music UK + MTV Polska + MTV UK + Muse + MUTV + Muzsika TV + myZen TV + n-tv Austria + N1 Bosna i Hercegovina + N1 Hrvatska + N1 Srbija + N24 Doku + Nat Geo People + National Geographic Bulgaria + National Geographic Channel HD Europe + National Geographic Deutschland + National Geographic España + National Geographic Hungary & Czechia + National Geographic Italia + National Geographic Polska + National Geographic Türkiye + National Geographic UK + National Geographic Wild Bulgaria + National Geographic Wild Deutschland + National Geographic Wild España + National Geographic Wild Hungary + National Geographic Wild Italia + National Geographic Wild Polska + National Geographic Wild Türkiye + National Geographic Wild UK + Nautical Channel + Naša TV + NBA TV + NDR Fernsehen + Neon TV + Neox + Net TV + News 24 + Nick Jr Central & Eastern Europe + Nick Jr Deutschland + Nick Jr España + Nick Jr Hungary + Nick Jr Italia + Nick Jr Too UK + Nick Jr UK + Nickelodeon Deutschland + Nickelodeon en Español + Nickelodeon Europe + Nickelodeon Italia + Nickelodeon Magyarország + Nickelodeon Polska + Nickelodeon UK + Nicktoons Adria + Nicktoons Deutschland + Nicktoons Polska + NickToons UK + Nitro Deutschland + Nostalgia + Nova + Nova 24 TV + Nova BH + Nova Cinema + Nova M + Nova News + Nova S + Nova Sport + Nova Sport + Nova TV + Nova TV + Nova World + Nove + Novela TV + Novosadska TV + Now 70s + Now 80s + Now 90s + Nowa TV + NRJ 12 + nSport+ + NTV + NTV 101 + NTV Amna + NTV IC + NTV Jasmin + Number 1 Türk + Nuta TV + O Kanal + OBN + Odisea + One + Ora News + ORF 1 + ORF 2 + ORF III + ORF Sport + + Osječka TV + OSM TV + Oto + OTV Valentino + Paramount Channel España + Paramount Channel Polska + Paramount Network Hungary + Paramount Network Italia + Paris Première + Passion XXX + Pax TV + PBS America + Pesca + PeTV + Phoenix + Pick UK + Pickbox TV + Pikaboo + Pikaboo 2 + Pink Action + Pink BH + Pink Classic + Pink Comedy + Pink Crime & Mystery + Pink Erotic 1 + Pink Erotic 2 + Pink Erotic 3 + Pink Erotic 4 + Pink Erotic 5 + Pink Erotic 6 + Pink Erotic 7 + Pink Erotic 8 + Pink Extra + Pink Family + Pink Fashion + Pink Film + Pink Folk 1 + Pink Folk 2 + Pink Hits + Pink Horror + Pink Kids + Pink Koncert + Pink Kuvar + Pink M + Pink Movies + Pink Music + Pink n Roll + Pink Parada + Pink Pedia + Pink Plus + Pink Premium + Pink Reality + Pink Romance + Pink Sci-Fi & Fantasy + Pink Serije + Pink Show + Pink Soap + Pink Srbija + Pink Style + Pink Super Kids + Pink Thriller + Pink Timeout + Pink Western + Pink World + Pink World Cinema + Pink Zabava + Planet 2 + Planet Earth + Planet TV + Planeta Folk + Planeta TV + Planete+ Polska + Plava televizija + Plava Vinkovačka + Playboy TV Europe + Plovdivska Pravoslavna TV + Poljoprivredna TV + Polo TV + Polonia 1 + Polsat + Polsat 2 + Polsat Café + Polsat Comedy Central Extra + Polsat Doku + Polsat Film + Polsat Games + Polsat Music + Polsat News + Polsat News 2 + Polsat Play + Polsat Rodzina + Polsat Rodzina + Polsat Seriale + Polsat Sport + Polsat Sport Extra + Polsat Sport Fight + Polsat Sport News + Polsat Viasat Explore + Polsat Viasat History + Polsat Viasat Nature + Pop + Pop Max + Pop TV + Power TV + Power TV + Power Türk TV + Premium Action + Premium Cinema 1 + Premium Crime + Premium Stories + Prime + Private TV + ProSieben Deutschland + ProSieben Fun + ProSieben Maxx Deutschland + Prva Files + Prva Kick + Prva Life + Prva Max + Prva Plus + Prva Srpska TV + Prva TV Crna Gora + Prva World + Puls 2 + Puls Acht + Pulse 4 + Quest UK + QVC Beauty + QVC Deutschland + QVC Style + QVC Style Deutschland + QVC Zwei + Radio Bremen Fernsehen + Radio Italia TV + Radiofreccia + Rai 1 + Rai 2 + Rai 3 + Rai 3 Bis + Rai 4 + Rai 5 + Rai Gulp + Rai Movie + Rai News 24 + Rai Premium + Rai Scuola + Rai Sport + Rai Storia + Rai Yoyo + Ras TV + rbb Fernsehen + Real Madrid TV + Real Time Italia + Really UK + Red Carpet TV + Red TV + Report TV + Rete 4 + Revelation TV + Ring TV + RMC Story + RNF + Romance TV Deutschland + Romance TV Polska + RSI La 1 + RSI La 2 + RT + RT Documentary + RTK 1 + RTL Adria Hrvatska + RTL Crime Deutschland + RTL Crime Hrvatska + RTL Croatia World + RTL Deutschland + RTL Deutschland + RTL Gold + RTL II + RTL Klub + RTL Kockica + RTL Living Deutschland + RTL Living Hrvatska + RTL Passion Deutschland + RTL Passion Hrvatska + RTL Plus + RTL Zwei Austria + RTL Zwei Deutschland + RTL+ + RTSH 1 + RTSH 2 + RTSH 24 + RTSH 3 + RTSH Film + RTSH Gjirokastra + RTSH Plus + RTSH Sat + RTSH Shkolle + RTSH Shqip + RTSH Sport + RTV 1 + RTV 2 + RTV Budva + RTV Goražde + RTV HB + RTV HIT + RTV Pančevo + RTV Slobomir + RTV Slon + RTV Sreće + RTV USK + RTV Vikom + RTV Visoko + RTV Vogošća + RTV Zenica + RTV21 + RTV7 + RTVTK + S Sport + S Sport 2 + S1 + S4C + Samobor TV + Sat TV + Sat.1 Deutschland + Sat.1 Emotions + Sat.1 Gold Deutschland + SBTV + SchauTV + Scifi Srbija + Sevdah TV + Sexation TV + Show TV + Show Türk + Sinema 1001 + Sinema 1002 + Sinema 2 + Sinema Aile + Sinema Aile 2 + Sinema Aksiyon + Sinema Aksiyon 2 + Sinema Komedi + Sinema Komedi 2 + Sinema TV + Sinema Yerli + Sinema Yerli 2 + SIP TV + Sitel TV + Sixx Austria + Sixx Deutschland + Sky Arte + Sky Arts UK + Sky Atlantic + Sky Atlantic + Sky Cinema Action + Sky Cinema Action + Sky Cinema Action + Sky Cinema Collection + Sky Cinema Comedy + Sky Cinema Comedy + Sky Cinema Drama + Sky Cinema Drama + Sky Cinema Due + Sky Cinema Family + Sky Cinema Family + Sky Cinema Family + Sky Cinema Greats + Sky Cinema Hits + Sky Cinema Premiere + Sky Cinema Romance + Sky Cinema Sci Fi & Horror + Sky Cinema Select + Sky Cinema Suspense + Sky Cinema Thriller + Sky Cinema Uno + Sky Documentaries UK + Sky History + Sky History 2 + Sky Krimi + Sky News International + Sky One + Sky Sport 1 + Sky Sport 2 + Sky Sport 2 + Sky Sport 24 + Sky Sport 3 + Sky Sport 9 + Sky Sport Bundesliga 1 + Sky Sport F1 + Sky Sport MotoGP + Sky Sport NBA + Sky Sport Uno + Sky Sports Arena + Sky Sports Cricket + Sky Sports F1 + Sky Sports Footbal + Sky Sports Golf + Sky Sports Main Event + Sky Sports Mix + Sky Sports News + Sky Sports Premier League UK + Sky Uno + Slavonska TV + Sláger TV + Smart TV + Smithsonian Channel UK + SonLife Broadcasting Network + Sony AXN + Sony Channel Deutschland + Sony Channel UK + Sony Max Hungary + Sony Movie Channel Hungary + Sony Movies +1 + Sony Movies Action + Sony Movies Classic + Sony Movies UK + Sorozat+ + Spektrum + Spektrum Home + Spiegel TV Wissen + Spor Smart + Spor Smart 2 + Sport 1 + Sport 1 Hungary + Sport 2 Hungary + Sport Klub 1 BiH + Sport Klub 1 Crna Gora + Sport Klub 1 Hrvatska + Sport Klub 1 Slovenija + Sport Klub 1 Srbija + Sport Klub 2 Slovenija + Sport Klub 2 Srbija + Sport Klub 3 + Sport Klub 4 + Sport Klub Esports + Sport Klub Golf + Sport Klub HD + Sport Klub Polska + Sport TV 1 + Sport TV 2 + Sport+ HD + Sport1+ + Sportitalia + Spotlight TV + SPTV + Spíler1 TV + Spíler2 TV + SR Fernsehen + Sremska TV + SRF 1 + SRF Info + SRF zwei + Star TV + Stars TV + Stinet + Stingray Classica + Stingray Djazz + Stingray iConcerts + Story4 + Studio B + STV East + STV Folk + Sundance TV Espana + Sundance TV Europe + Super Polsat + Super RTL Deutschland + Super TV2 + Super! + Superstar 2 + Superstar TV + SuperTennis + Swiss 1 + SWR Fernsehen + Syfy Deutschland + Syfy España + Syfy UK + Tagesschau24 + Talking Pictures TV + TAY TV + TCM Espana + TCM Movies + Tele 1 + Tele 5 + Tele 5 + TeleBärn + Telecinco + Teleclub Action + Teleclub Cinema + Teleclub City + Teleclub Emotion + Teleclub Retro + Teleclub Sport 1 + Teledeporte + teleTOON+ Polska + Teletutto + Televizija 5 + Televizija AS + TeleZüri + Telma + Teve 2 + teve2 + TF1 + TF1 Séries Films + TFX + TGCOM24 + TGRT Haber + The Box UK + The Fishing & Hunting Channel + The Voice TV + Tiankov Folk + Timeless Drama Channel + Tiny Pop + Tip TV + TJC + TLC Balkan + TLC Polska + TLC Türkiye + TLC UK + TMC Suisse + TNT Comedy + TNT España + TNT Kids TV + TNT Polska + TNT Serie + Together TV + Toggo Plus + Toon Kids + Top Channel + Top Crime + Top Kids + Top News + Top TV + Toros TV + Trace Urban + Travel Channel Europe + Travel Channel Polska + Travel TV + Travelxp HD Europe + Trend TV + Tribuna Channel + Tring Action + Tring Classic + Tring Comedy + Tring Family + Tring Fantasy + Tring History + Tring International + Tring Kids + Tring Life + Tring Planet + Tring Shqip + Tring Smile + Tring Sport 1 + Tring Sport 2 + Tring Sport 3 + Tring Sport News HD + Tring Super + Tring Tring + Tring World + Tropik TV + TRT 1 + TRT 2 + TRT Arabi + TRT Avaz + TRT Belgesel + TRT Haber + TRT Kurdî + TRT Müzik + TRT Spor + TRT Spor 2 + TRT Turk + TRT World + TRT Çocuk + TTV + TV 2000 + TV 4 + TV Arena + TV Belle Amie + TV Dalmacija + TV Duga+ + TV Edo + TV Evropa + TV Galaksija 32 + TV Galeja + TV Hram + TV Idea + TV Istra + TV Jadran + TV K23 + TV K3 + TV Kanal 25 + TV Klan + TV Koper-Capodistria + TV Maribor + TV Net + TV Nova + TV Novi Pazar + TV Paprika + TV Puls + TV Republika + TV Rodina + TV Shenja + TV Slovenija 1 + TV Slovenija 2 + TV Slovenija 3 + TV Sonce + TV Trwam + TV Vijesti + TV Zapad + TV Šibenik + TV+ + TV1 + TV100 + TV1000 Balkan + TV1000 World Kino + TV1000 Русское кино + TV2 + TV2 Comedy + TV2 Kids + TV2 Séf + TV24 + TV25 + TV3 + TV4 + TV5Monde Europe + TV6 + TV7 + TV8 + TV8 + TV8.5 + TVCG Sat + TVCG1 + TVCG2 + TVN + TVN 7 + TVN Fabuła + TVN Style + TVN Turbo + TVN24 + TVN24 BiS + TVP 1 + TVP 2 + TVP 3 Warszawa + TVP ABC + TVP HD + TVP Historia + TVP Info + TVP Kultura + TVP Polonia + TVP Regionalna + TVP Rozrywka + TVP Seriale + TVP Sport + TVP3 Białystok + TVP3 Bydgoszcz + TVP3 Gdańsk + TVP3 Katowice + TVP3 Kielce + TVP3 Kraków + TVP3 Lublin + TVP3 Olsztyn + TVP3 Opole + TVP3 Poznań + TVP3 Rzeszów + TVP3 Szczecin + TVP3 Warszawa + TVP3 Wrocław + TVP3 Łódź + TVR + TVS + TVSA + TWR United Kingdom + UTV + UTV News + Uçankuş TV + Valentino Etno + Valentino Music + Varaždinska TV + Vavoom + Vaš kanal + Veseljak TV + VH1 Italia + Viajar + Viasat 3 + Viasat 6 + Viasat Explore East + Viasat History + Viasat Nature East + Vivacom Arena + Vizion Plus + Vosges Télévision + Vox Deutschland + Vox Music TV + VTK + VTV + W UK + W24 + W9 Suisse + WDR Fernsehen Koln + Welt + Wness TV + Woman + World Fashion Channel Russia + WP TV + wPolsce.pl + XXL + Yaban + Yesterday + Z1 + ZDF + ZDFinfo + ZDFneo + Zdrava televizija + Zenebutik + Zoom TV + Çufo + Ülke TV + Šport TV 1 + Šport TV 2 + Šport TV 3 + БК ТВ + БНТ 1 + БНТ 2 + БНТ 3 + БНТ 4 + БСТВ + БХТВ + България 24 + Казбука ТВ + Канал 8 ТВ + МТМ ТВ + Первый канал + Россия 24 + РТР-Планета + РТРС + РТРС плус + РТС 1 + РТС 2 + РТС 3 + РТС Драма + РТС Живот + РТС Коло + РТС Музика + РТС Полетарац + РТС Свет + РТС Трезор + ТВ СКАТ + ТВ СТЗ + Тера + Україна 24 + + \ No newline at end of file diff --git a/sites/tvprofil.com.config.js b/sites/tvprofil.com.config.js new file mode 100644 index 00000000..3a231197 --- /dev/null +++ b/sites/tvprofil.com.config.js @@ -0,0 +1,106 @@ +const cheerio = require('cheerio') +const dayjs = require('dayjs') + +module.exports = { + lang: 'hr', + site: 'tvprofil.com', + channels: 'tvprofil.com.channels.xml', + output: '.gh-pages/guides/tvprofil.com.guide.xml', + request: { + headers: { + 'x-requested-with': 'XMLHttpRequest' + } + }, + url: function ({ channel, date }) { + const parts = channel.site_id.split('#') + const query = buildQuery(parts[1], date) + + return `https://tvprofil.com/${parts[0]}/program/?${query}` + }, + logo: function ({ content }) { + const result = parseContent(content) + + return `https://cdn-0.tvprofil.com/cdn/100x40/10/img/kanali-logo/${result.data.channel.logo}` + }, + parser: function ({ content, channel, date }) { + let programs = [] + const result = parseContent(content) + const items = parseItems(result.data.program) + items.forEach(item => { + const $item = cheerio.load(item) + const title = parseTitle($item) + const category = parseCategory($item) + const start = parseStart($item) + const duration = parseDuration($item) + const stop = start.add(duration, 's') + const icon = parseIcon($item) + + programs.push({ title, category, start, stop, icon }) + }) + + return programs + } +} + +function parseIcon($item) { + return $item(':root').data('image') +} + +function parseDuration($item) { + return $item(':root').data('len') +} + +function parseStart($item) { + const timestamp = $item(':root').data('ts') + + return dayjs.unix(timestamp) +} + +function parseCategory($item) { + return $item('.col:nth-child(2) > small').text() || null +} + +function parseTitle($item) { + let title = $item('.col:nth-child(2) > a').text() + title += $item('.col:nth-child(2)').clone().children().remove().end().text() + + return title.replace('®', '').trim().replace(/,$/, '') +} + +function parseItems(program) { + const $ = cheerio.load(program) + + return $('.row').toArray() +} + +function parseContent(content) { + let data = (content.match(/cb\((.*)\)/) || [null, null])[1] + + return JSON.parse(data) +} + +function buildQuery(site_id, date) { + const query = { + datum: date.format('YYYY-MM-DD'), + kanal: site_id, + callback: `cb` + } + + const a = query.datum + query.kanal + const ua = query.kanal + query.datum + + let i = a.length, + b = 2, + c = 2 + + for (var j = 0; j < ua.length; j++) c += ua.charCodeAt(j) + while (i--) { + b += (a.charCodeAt(i) + c * 2) * i + } + + const key = 'b' + b.toString().charCodeAt(2) + + query[key] = b + + return new URLSearchParams(query).toString() +} diff --git a/sites/tvtv.us.channels.xml b/sites/tvtv.us.channels.xml index ffe99308..60675d52 100755 --- a/sites/tvtv.us.channels.xml +++ b/sites/tvtv.us.channels.xml @@ -2437,7 +2437,7 @@ MASN2 MBC America MBC America (WKTB-CD5) - MBC Drama (Korean) + MBC Drama MCAETv MCAETv (K38JP-DT3) MGM HD USA diff --git a/sites/vidio.com.channels.xml b/sites/vidio.com.channels.xml index 527e0676..6a3cfd92 100644 --- a/sites/vidio.com.channels.xml +++ b/sites/vidio.com.channels.xml @@ -8,13 +8,13 @@ AJWA TV Kompas TV BeritaSatu - METRO TV + Metro TV NET. - TRANS TV HD + Trans TV TVRI Nasional - TRANS 7 HD + Trans 7 MNCTV - Jaktv + Jak TV GTV RTV iNews @@ -27,6 +27,7 @@ Champions TV 2 Fox Sports Asia beIN Sports 1 Asia + beIN Sports 2 Asia Fox Sports 2 Asia Fox Sports 3 Asia Arirang TV diff --git a/sites/znbc.co.zm.config.js b/sites/znbc.co.zm.config.js index f36d259a..7f078b55 100644 --- a/sites/znbc.co.zm.config.js +++ b/sites/znbc.co.zm.config.js @@ -2,9 +2,11 @@ const jsdom = require('jsdom') const { JSDOM } = jsdom const dayjs = require('dayjs') const utc = require('dayjs/plugin/utc') +const timezone = require('dayjs/plugin/timezone') const customParseFormat = require('dayjs/plugin/customParseFormat') dayjs.extend(utc) +dayjs.extend(timezone) dayjs.extend(customParseFormat) module.exports = { @@ -24,43 +26,52 @@ module.exports = { return img ? img.dataset.src : null }, parser({ content, date }) { - const day = date.day() // 0 => Sunday const programs = [] - const dom = new JSDOM(content) - const tabs = dom.window.document.querySelectorAll( - `.elementor-tabs-content-wrapper > div[id*='elementor-tab-content']` - ) - const items = tabs[day].querySelectorAll(`table > tbody > tr`) - + const items = parseItems(content, date) items.forEach(item => { - const row = (item.querySelector('td > p') || { textContent: '' }).textContent - const parts = row.split(' ') - const time = parts.shift() - const title = parts - .filter(str => str && /\S/g.test(str)) - .map(i => i.trim()) - .join(' ') - - if (!time || !title) return false - - const start = dayjs - .utc(time, 'HH:mm') - .set('D', date.get('D')) - .set('M', date.get('M')) - .set('y', date.get('y')) - - if (!start.isValid()) return false - - if (programs.length && !programs[programs.length - 1].stop) { + const title = parseTitle(item) + const start = parseStart(item, date) + const stop = parseStop(item, date) + if (programs.length) { programs[programs.length - 1].stop = start } - programs.push({ - title, - start - }) + programs.push({ title, start, stop }) }) return programs } } + +function parseStop(item, date) { + return date.endOf('d') +} + +function parseStart(item, date) { + const row = (item.querySelector('td > p') || { textContent: '' }).textContent + let time = row.split(' ').shift() + time = `${date.format('MM/DD/YYYY')} ${time}` + + return dayjs.tz(time, 'MM/DD/YYYY HH:mm', 'Africa/Lusaka') +} + +function parseTitle(item) { + const row = (item.querySelector('td > p') || { textContent: '' }).textContent + const title = row.split(' ') + title.shift() + + return title + .map(i => i.trim()) + .filter(s => s) + .join(' ') +} + +function parseItems(content, date) { + const day = date.day() // 0 => Sunday + const dom = new JSDOM(content) + const tabs = dom.window.document.querySelectorAll( + `.elementor-tabs-content-wrapper > div[id*='elementor-tab-content']` + ) + + return tabs[day].querySelectorAll(`table > tbody > tr:not(:first-child)`) +}