mlbserver 2024.7.27-2 → 2024.8.2-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.js +28 -23
  2. package/package.json +1 -1
  3. package/session.js +36 -32
package/index.js CHANGED
@@ -221,6 +221,8 @@ app.get('/clearcache', async function(req, res) {
221
221
 
222
222
  session.log('Clearing cache...')
223
223
  session.clear_cache()
224
+ session.log('Clearing session...')
225
+ session.clear_session_data()
224
226
  session = new sessionClass(argv)
225
227
 
226
228
  let server = 'http://' + req.headers.host
@@ -1503,28 +1505,29 @@ app.get('/', async function(req, res) {
1503
1505
 
1504
1506
  let currentDate = new Date()
1505
1507
 
1506
- // MLB Network live stream for paid accounts
1508
+ // MLB Network live stream for eligible USA subscribers
1507
1509
  try {
1508
- let entitlements = await session.getEntitlements()
1509
- if ( entitlements.includes('MLBN') || entitlements.includes('MLBALL') || entitlements.includes('MLBTVMLBNADOBEPASS') ) {
1510
- body += '<tr><td><span class="tooltip">MLB Network<span class="tooltiptext">MLB Network live stream is now included with paid MLBTV subscriptions, or as a paid add-on, in addition to authenticated TV subscribers. <a href="https://www.mlb.com/news/mlb-network-launches-direct-to-consumer-streaming-option">See here for more information</a>.</span></span></td><td>'
1511
- let querystring = '?event=MLBN'
1512
- let multiviewquerystring = querystring + '&resolution=' + DEFAULT_MULTIVIEW_RESOLUTION
1513
- if ( linkType == VALID_LINK_TYPES[0] ) {
1514
- if ( startFrom != VALID_START_FROM[0] ) querystring += '&startFrom=' + startFrom
1515
- if ( controls != VALID_CONTROLS[0] ) querystring += '&controls=' + controls
1516
- }
1517
- if ( resolution != VALID_RESOLUTIONS[0] ) querystring += '&resolution=' + resolution
1518
- if ( linkType == VALID_LINK_TYPES[1] ) {
1519
- if ( force_vod != VALID_FORCE_VOD[0] ) querystring += '&force_vod=' + force_vod
1520
- }
1521
- querystring += content_protect_b
1522
- multiviewquerystring += content_protect_b
1523
- body += '<a href="' + thislink + querystring + '">MLB Network</a>'
1524
- body += '<input type="checkbox" value="' + server + '/stream.m3u8' + multiviewquerystring + '" onclick="addmultiview(this)">'
1525
- body += '</td></tr>' + "\n"
1526
-
1527
- }
1510
+ if ( session.credentials.country == 'USA' ) {
1511
+ let entitlements = await session.getEntitlements()
1512
+ if ( entitlements.includes('MLBN') || entitlements.includes('EXECMLB') || entitlements.includes('MLBTVMLBNADOBEPASS') ) {
1513
+ body += '<tr><td><span class="tooltip">MLB Network<span class="tooltiptext">MLB Network live stream is now available in the USA for paid MLBTV subscribers or as a paid add-on, in addition to authenticated TV subscribers. <a href="https://www.mlb.com/news/mlb-network-launches-direct-to-consumer-streaming-option">See here for more information</a>.</span></span></td><td>'
1514
+ let querystring = '?event=MLBN'
1515
+ let multiviewquerystring = querystring + '&resolution=' + DEFAULT_MULTIVIEW_RESOLUTION
1516
+ if ( linkType == VALID_LINK_TYPES[0] ) {
1517
+ if ( startFrom != VALID_START_FROM[0] ) querystring += '&startFrom=' + startFrom
1518
+ if ( controls != VALID_CONTROLS[0] ) querystring += '&controls=' + controls
1519
+ }
1520
+ if ( resolution != VALID_RESOLUTIONS[0] ) querystring += '&resolution=' + resolution
1521
+ if ( linkType == VALID_LINK_TYPES[1] ) {
1522
+ if ( force_vod != VALID_FORCE_VOD[0] ) querystring += '&force_vod=' + force_vod
1523
+ }
1524
+ querystring += content_protect_b
1525
+ multiviewquerystring += content_protect_b
1526
+ body += '<a href="' + thislink + querystring + '">MLB Network</a>'
1527
+ body += '<input type="checkbox" value="' + server + '/stream.m3u8' + multiviewquerystring + '" onclick="addmultiview(this)">'
1528
+ body += '</td></tr>' + "\n"
1529
+ } // end entitlements check
1530
+ } // end country check
1528
1531
  } catch (e) {
1529
1532
  session.debuglog('MLB Network detect error : ' + e.message)
1530
1533
  }
@@ -2110,7 +2113,7 @@ app.get('/', async function(req, res) {
2110
2113
  resolution = 'best'
2111
2114
  }
2112
2115
 
2113
- body += '<p><span class="tooltip">All<span class="tooltiptext">Will include all live MLB broadcasts. If favorite team(s) have been provided, it will also include affiliate games for those organizations. If a zip code has been provided, channels/games subject to blackout will be omitted by default. See below for an additional option to override that.</span></span>: <a href="/channels.m3u?mediaType=' + mediaType + '&resolution=' + resolution + content_protect_b + '">channels.m3u</a> and <a href="/guide.xml?mediaType=' + mediaType + content_protect_b + '">guide.xml</a> and <a href="/calendar.ics?mediaType=' + mediaType + content_protect_b + '">calendar.ics</a></p>' + "\n"
2116
+ body += '<p><span class="tooltip">All<span class="tooltiptext">Will include all live MLB broadcasts (all games plus MLB Network, Big Inning, Game Changer, and Multiview). If favorite team(s) have been provided, it will also include affiliate games for those organizations. If a zip code has been provided, channels/games subject to blackout will be omitted by default. See below for an additional option to override that.</span></span>: <a href="/channels.m3u?mediaType=' + mediaType + '&resolution=' + resolution + content_protect_b + '">channels.m3u</a> and <a href="/guide.xml?mediaType=' + mediaType + content_protect_b + '">guide.xml</a> and <a href="/calendar.ics?mediaType=' + mediaType + content_protect_b + '">calendar.ics</a></p>' + "\n"
2114
2117
 
2115
2118
  let include_teams = 'atl,national'
2116
2119
  if ( session.credentials.fav_teams.length > 0 ) {
@@ -2129,6 +2132,8 @@ app.get('/', async function(req, res) {
2129
2132
 
2130
2133
  body += '<p><span class="tooltip">Include (or exclude) LIDOM<span class="tooltiptext">Dominican Winter League, aka Liga de Beisbol Dominicano. Live stream only, does not support starting from the beginning or certain innings, skip options, etc.</span></span>: <a href="/channels.m3u?mediaType=' + mediaType + '&resolution=' + resolution + '&includeTeams=lidom' + content_protect_b + '">m3u</a> and <a href="/guide.xml?mediaType=' + mediaType + '&includeTeams=lidom' + content_protect_b + '">xml</a> and <a href="/calendar.ics?mediaType=' + mediaType + '&includeTeams=lidom' + content_protect_b + '">ics</a></p>' + "\n"
2131
2134
 
2135
+ body += '<p><span class="tooltip">Include (or exclude) MLB Network<span class="tooltiptext">MLB Network live stream is now available in the USA for paid MLBTV subscribers or as a paid add-on, in addition to authenticated TV subscribers. <a href="https://www.mlb.com/news/mlb-network-launches-direct-to-consumer-streaming-option">See here for more information</a>.</span></span>: <a href="/channels.m3u?mediaType=' + mediaType + '&resolution=' + resolution + '&includeTeams=mlbn' + content_protect_b + '">m3u</a> and <a href="/guide.xml?mediaType=' + mediaType + '&includeTeams=mlbn' + content_protect_b + '">xml</a> and <a href="/calendar.ics?mediaType=' + mediaType + '&includeTeams=mlb' + content_protect_b + '">ics</a></p>' + "\n"
2136
+
2132
2137
  body += '<p><span class="tooltip">Include (or exclude) Big Inning<span class="tooltiptext">Big Inning is the live look-in and highlights show. <a href="https://www.mlb.com/live-stream-games/big-inning">See here for more information</a>.</span></span>: <a href="/channels.m3u?mediaType=' + mediaType + '&resolution=' + resolution + '&includeTeams=biginning' + content_protect_b + '">m3u</a> and <a href="/guide.xml?mediaType=' + mediaType + '&includeTeams=biginning' + content_protect_b + '">xml</a> and <a href="/calendar.ics?mediaType=' + mediaType + '&includeTeams=biginning' + content_protect_b + '">ics</a></p>' + "\n"
2133
2138
 
2134
2139
  let gamechanger_resolution = resolution
@@ -2212,7 +2217,7 @@ app.get('/', async function(req, res) {
2212
2217
  body += '<p><span class="tooltip">Bookmarklets for MLB.com<span class="tooltiptext">If you watch at MLB.com, drag these bookmarklets to your bookmarks toolbar and use them to hide parts of the interface.</span></span>: <a href="javascript:(function(){let x=document.querySelector(\'#mlbtv-stats-panel\');if(x.style.display==\'none\'){x.style.display=\'initial\';}else{x.style.display=\'none\';}})();">Boxscore</a> | <a href="javascript:(function(){let x=document.querySelector(\'.mlbtv-header-container\');if(x.style.display==\'none\'){let y=document.querySelector(\'.mlbtv-players-container\');y.style.display=\'none\';x.style.display=\'initial\';setTimeout(function(){y.style.display=\'initial\';},15);}else{x.style.display=\'none\';}})();">Scoreboard</a> | <a href="javascript:(function(){let x=document.querySelector(\'.mlbtv-container--footer\');if(x.style.display==\'none\'){let y=document.querySelector(\'.mlbtv-players-container\');y.style.display=\'none\';x.style.display=\'initial\';setTimeout(function(){y.style.display=\'initial\';},15);}else{x.style.display=\'none\';}})();">Linescore</a> | <a href="javascript:(function(){let x=document.querySelector(\'#mlbtv-stats-panel\');if(x.style.display==\'none\'){x.style.display=\'initial\';}else{x.style.display=\'none\';}x=document.querySelector(\'.mlbtv-header-container\');if(x.style.display==\'none\'){x.style.display=\'initial\';}else{x.style.display=\'none\';}x=document.querySelector(\'.mlbtv-container--footer\');if(x.style.display==\'none\'){let y=document.querySelector(\'.mlbtv-players-container\');y.style.display=\'none\';x.style.display=\'initial\';setTimeout(function(){y.style.display=\'initial\';},15);}else{x.style.display=\'none\';}})();">All</a></p>' + "\n"
2213
2218
 
2214
2219
  // Print version
2215
- body += '<p class="tinytext">Version ' + version + ' (<a href="/clearcache">clear cache</a>)</p>' + "\n"
2220
+ body += '<p class="tinytext">Version ' + version + ' (<a href="/clearcache">clear session and cache</a>)</p>' + "\n"
2216
2221
 
2217
2222
  // Datepicker functions
2218
2223
  body += '<script>var datePicker=document.getElementById("gameDate");function changeDate(e){date=datePicker.value;reload()}function removeDate(e){datePicker.removeEventListener("change",changeDate,false);datePicker.addEventListener("blur",changeDate,false);if(e.keyCode===13){date=datePicker.value;reload()}}datePicker.addEventListener("change",changeDate,false);datePicker.addEventListener("keypress",removeDate,false)</script>' + "\n"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mlbserver",
3
- "version": "2024.07.27-2",
3
+ "version": "2024.08.02-2",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
package/session.js CHANGED
@@ -2404,10 +2404,10 @@ class sessionClass {
2404
2404
  logo = 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRi5AKF6eAu9Va9BzZzgw0PSsQXw8rXPiQLHA'
2405
2405
  nationalChannels[channelid] = await this.create_channel_object(channelid, logo, stream, channelMediaType)
2406
2406
  } else {
2407
- seriesId = cache_data.dates[i].games[j].teams[teamType].team.teamId
2408
- //logo += '/image.svg?teamId=' + cache_data.dates[i].games[j].teams[teamType].team.teamId
2407
+ seriesId = cache_data.dates[i].games[j].teams[teamType].team.id
2408
+ //logo += '/image.svg?teamId=' + cache_data.dates[i].games[j].teams[teamType].team.id
2409
2409
  //if ( this.protection.content_protect ) logo += '&amp;content_protect=' + this.protection.content_protect
2410
- logo = 'https://www.mlbstatic.com/team-logos/share/' + cache_data.dates[i].games[j].teams[teamType].team.teamId + '.jpg'
2410
+ logo = 'https://www.mlbstatic.com/team-logos/share/' + cache_data.dates[i].games[j].teams[teamType].team.id + '.jpg'
2411
2411
  channels[channelid] = await this.create_channel_object(channelid, logo, stream, channelMediaType)
2412
2412
  }
2413
2413
 
@@ -2516,36 +2516,37 @@ class sessionClass {
2516
2516
  channels = this.sortObj(channels)
2517
2517
  channels = Object.assign(channels, nationalChannels)
2518
2518
 
2519
- // MLB Network
2519
+ // MLB Network live stream for eligible USA subscribers
2520
2520
  try {
2521
- let entitlements = await this.getEntitlements()
2522
- if ( entitlements.includes('MLBN') || entitlements.includes('MLBALL') || entitlements.includes('MLBTVMLBNADOBEPASS') ) {
2523
- if ( (mediaType == 'MLBTV') && ((includeLevels.length == 0) || includeLevels.includes('MLB') || includeLevels.includes('ALL')) ) {
2524
- if ( (excludeTeams.length > 0) && excludeTeams.includes('MLBN') ) {
2525
- // do nothing
2526
- } else if ( (includeTeams.length == 0) || includeTeams.includes('MLBN') ) {
2527
- this.debuglog('getTVData processing MLB Network')
2528
- let logo = 'https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcQRgC2JdbtFplKjfhXm5_vzpkUQ3XyDT91SEnHmuB0p5tReQ3Ez'
2529
- let channelid = mediaType + '.MLBN'
2530
- if ( this.protection.content_protect ) logo += '&amp;content_protect=' + this.protection.content_protect
2531
- let stream = server + '/stream.m3u8?event=mlbn&mediaType=Video&resolution=' + resolution
2532
- if ( this.protection.content_protect ) stream += '&content_protect=' + this.protection.content_protect
2533
- if ( pipe == 'true' ) stream = await this.convert_stream_to_pipe(stream, channelid)
2534
- channels[channelid] = await this.create_channel_object(channelid, logo, stream, mediaType)
2535
-
2536
- let title = 'MLB Network'
2537
- let description = 'Live stream of MLB Network'
2538
-
2539
- let start = this.convertDateToXMLTV(new Date(cache_data.dates[0].date + ' 00:00:00'))
2540
- let stop = this.convertDateToXMLTV(new Date(cache_data.dates[cache_data.dates.length-1].date + ' 00:00:00'))
2541
-
2542
- // Big Inning guide XML
2543
- programs += await this.generate_xml_program(channelid, start, stop, title, description, logo, this.convertStringToAirDate(cache_data.dates[0].date))
2544
- this.debuglog('getTVData completed MLB Network')
2545
- }
2546
- }
2547
-
2548
- }
2521
+ if ( this.credentials.country == 'USA' ) {
2522
+ let entitlements = await this.getEntitlements()
2523
+ if ( (this.credentials.country == 'USA') && (entitlements.includes('MLBN') || entitlements.includes('EXECMLB') || entitlements.includes('MLBTVMLBNADOBEPASS')) ) {
2524
+ if ( (mediaType == 'MLBTV') && ((includeLevels.length == 0) || includeLevels.includes('MLB') || includeLevels.includes('ALL')) ) {
2525
+ if ( (excludeTeams.length > 0) && excludeTeams.includes('MLBN') ) {
2526
+ // do nothing
2527
+ } else if ( (includeTeams.length == 0) || includeTeams.includes('MLBN') ) {
2528
+ this.debuglog('getTVData processing MLB Network')
2529
+ let logo = 'https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcQRgC2JdbtFplKjfhXm5_vzpkUQ3XyDT91SEnHmuB0p5tReQ3Ez'
2530
+ let channelid = mediaType + '.MLBN'
2531
+ if ( this.protection.content_protect ) logo += '&amp;content_protect=' + this.protection.content_protect
2532
+ let stream = server + '/stream.m3u8?event=mlbn&mediaType=Video&resolution=' + resolution
2533
+ if ( this.protection.content_protect ) stream += '&content_protect=' + this.protection.content_protect
2534
+ if ( pipe == 'true' ) stream = await this.convert_stream_to_pipe(stream, channelid)
2535
+ channels[channelid] = await this.create_channel_object(channelid, logo, stream, mediaType)
2536
+
2537
+ let title = 'MLB Network'
2538
+ let description = 'Live stream of MLB Network'
2539
+
2540
+ let start = this.convertDateToXMLTV(new Date(cache_data.dates[0].date + ' 00:00:00'))
2541
+ let stop = this.convertDateToXMLTV(new Date(cache_data.dates[cache_data.dates.length-1].date + ' 00:00:00'))
2542
+
2543
+ // MLB Network guide XML
2544
+ programs += await this.generate_xml_program(channelid, start, stop, title, description, logo, this.convertStringToAirDate(cache_data.dates[0].date))
2545
+ this.debuglog('getTVData completed MLB Network')
2546
+ } // end includeTeams check
2547
+ } // end mediaType check
2548
+ } // end entitlements check
2549
+ } // end country check
2549
2550
  } catch (e) {
2550
2551
  this.debuglog('getTVData MLB Network detect error : ' + e.message)
2551
2552
  }
@@ -2828,6 +2829,9 @@ class sessionClass {
2828
2829
  if ( streamURLToken ) {
2829
2830
  variant_url += '&streamURLToken=' + encodeURIComponent(streamURLToken)
2830
2831
  }
2832
+ if ( this.protection.content_protect ) {
2833
+ variant_url += '&content_protect=' + this.protection.content_protect
2834
+ }
2831
2835
  let reqObj = {
2832
2836
  url: variant_url
2833
2837
  }