NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Add-ons (3rd party plugins, utilities and skins) v
« Previous 1 2 3 4 5 6 … 20 Next »
YouTube Plugin

 
  • 0 Vote(s) - 0 Average
YouTube Plugin
whurlston
Offline

Posting Freak

Posts: 7,885
Threads: 102
Joined: Nov 2006
#561
2015-01-15, 04:50 AM
Looks like I have quite a bit of updating to do on the instructions/description on the wiki. So here is the latest build.

The NUtilities update is probably not essential. There is only a small change from the one previously posted (but one Martin will appreciate): Now when using the onscreen keyboard with a real keyboard, pressing <Enter> on the real keyboard will submit the search if it is pressed within 2 seconds of the last character typed.

Youtube changes (probably not a complete list):

  1. Improved parser.aspx (should work with all videos as of this posting).
  2. Internal changes to support the parser.aspx changes.
  3. Fixed a bug where an error could occur when reading the results from parser.aspx
  4. Fixed an issue where backing out of a search would result in exiting the plugin instead of returning to the main category list.
whurlston
Offline

Posting Freak

Posts: 7,885
Threads: 102
Joined: Nov 2006
#562
2015-01-15, 11:30 PM
If anyone is having trouble getting the above patch to work, I accidentally forgot the "s" on the "Plugins" folder in the zip file.
mvallevand
Online

Posting Freak

Ontario Canada
Posts: 53,020
Threads: 956
Joined: May 2006
#563
2015-01-15, 11:40 PM
Quote:2015-01-15 18:37:38.896 [DEBUG][1] ClientKeyPress(Return)
...
2015-01-15 18:37:39.160 [DEBUG][1] Searching for thanks whurlston

I haven't updated anything else yet and don't have this missing folder either! but YouTube playback never stopped to x-newa web client because the url is still good.

Martin
UncleJohnsBand
Offline

Posting Freak

U.S.A.
Posts: 5,643
Threads: 258
Joined: Feb 2005
#564
2015-01-16, 02:19 AM
whurlston Wrote:If anyone is having trouble getting the above patch to work, I accidentally forgot the "s" on the "Plugins" folder in the zip file.

I caught it after I unzipped it and just moved the files over to the correct directory and then deleted the one without the s. Smile
Intel Core i7 @ 4.00GHz Skylake 14nm
ASUSTeK COMPUTER INC. Z170-DELUXE
Windows 10 Pro x64
PVR Software: NPVR 5.1.1
SiliconDust HDHomeRun HDHR5-4US Connect Quatro 4 Channel Tuner
Roku Ultra
2 PCH A-100's
whurlston
Offline

Posting Freak

Posts: 7,885
Threads: 102
Joined: Nov 2006
#565
2015-01-16, 04:34 AM
mvallevand Wrote:I haven't updated anything else yet and don't have this missing folder either! but YouTube playback never stopped to x-newa web client because the url is still good.

Martin
Yeah, PC/NMT would be the only things affected by they parser.aspx but you might still want to update it. If you did a search as soon as you started the plugin, there was no way to get back to your configured categories/feeds because exiting out of the search exited out of the plugin completely. All other changes shouldn't really affect you though.

Figured you would like the change to the onscreen keyboard. Every time I pulled out the keyboard here, I kept cursing myself for not implementing that before. Smile
jksmurf
Offline

Posting Freak

HK (DMBTH)
Posts: 3,590
Threads: 410
Joined: Jul 2005
#566
2015-01-18, 07:36 AM (This post was last modified: 2015-01-18, 07:45 AM by jksmurf.)
whurlston Wrote:Sorry, lost power right after my last post. You can create the empty scripts folder and the parser.aspx will use it to cache some scripts when you select a video. You might get a couple of other errors though. I'm working on packaging an update with several bug fixes and should have it posted within the hour. It will also create the scripts folder if it does not exist.

OK I had the issue of the missing scripts folder, and without that it threw as message about now html5player.js
I then added that scripts folder, but got a new error, as attached "unable to determine signature decryption function"?

As that error was similar to the one which was fixed a few posts ago, by modifying the parser at line 37, I tried to redo that fix on the current parser. But this time it did not fix it.
k.
ASUS STRIX X470-F AMD 2700x 4GHz | Win10Prox64 | 32GB | NVIDIA GEforce GT1030 Fanless | WinTV DMB-TH | WinTV HVR-1280 | Hauppauge Colossus | AC86U/AC68U | USB-UIRT | RPi4 Libreelec | Sony Bravia LCD X9000F Android TV |
Reddwarf
Offline

Posting Freak

Posts: 6,629
Threads: 230
Joined: Mar 2007
#567
2015-01-18, 02:09 PM
Also got an exception trying to play a video, it seeme it is complaining about a ";" character, did not get the screenshot, sorry.

"I'd rather have a bottle in front of me than a frontal lobotomy"
mvallevand
Online

Posting Freak

Ontario Canada
Posts: 53,020
Threads: 956
Joined: May 2006
#568
2015-01-18, 03:23 PM (This post was last modified: 2015-01-18, 04:02 PM by mvallevand.)
Reddwarf Wrote:Also got an exception trying to play a video, it seeme it is complaining about a ";" character, did not get the screenshot, sorry.

I installed in NextPVR and got this too, but that was because it installed to Plugin not Plugins, moving the dll's fixes that error, but I still can't play any streams.
Code:
2015-01-18 11:01:26.648    [DEBUG][1]    YouTube: External parsing successful.
2015-01-18 11:01:26.648    [DEBUG][1]    YouTube: No encrypted signatures detected.
2015-01-18 11:01:26.648    [DEBUG][1]    YouTube: Attempting to deserialize stream data.
2015-01-18 11:01:26.817    [ERROR][1]    YouTube: External parsing failed.
2015-01-18 11:01:26.817    [DEBUG][1]    YouTube: Parsed pconfig in 822ms
2015-01-18 11:01:26.817    [ERROR][1]    YouTube: Could not get streams for 5Ov8xEuX2XI
2015-01-18 11:01:26.817    [DEBUG][1]    Unable to deserialize results


To get around the html5player.js error I just created web\public\scripts could that be the problem?

On the web client side there were changes in VEVO, I know I had to update the Kodi addon recently, but these streams do play from the url the plugin provides so still works great and still my favourite way of watching youtube.

Martin
jksmurf
Offline

Posting Freak

HK (DMBTH)
Posts: 3,590
Threads: 410
Joined: Jul 2005
#569
2015-01-18, 11:52 PM (This post was last modified: 2015-01-19, 12:24 PM by jksmurf.)
mvallevand Wrote:To get around the html5player.js error I just created web\public\scripts could that be the problem?
Martin

As above

Quote:I then added that scripts folder, but got a new error, as attached "unable to determine signature decryption function"?

I added the folder already, all good for the FIRST error message but then I got a different message. (btw the zip file needs to be udpated to add this in?)

k.
ASUS STRIX X470-F AMD 2700x 4GHz | Win10Prox64 | 32GB | NVIDIA GEforce GT1030 Fanless | WinTV DMB-TH | WinTV HVR-1280 | Hauppauge Colossus | AC86U/AC68U | USB-UIRT | RPi4 Libreelec | Sony Bravia LCD X9000F Android TV |
whurlston
Offline

Posting Freak

Posts: 7,885
Threads: 102
Joined: Nov 2006
#570
2015-01-19, 03:19 AM
Sorry guys, not sure where I pulled that parser.aspx from. Line 38 is missing the code to remove the ";" that it's complaining about and it should have had code to create the scripts folder if it doesn't exist. Here is the one that should have been in the zip:

Code:
<%@ Page Language="C#" AutoEventWireup="true" %>
<%@ Import Namespace="System.Net" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="N_EWA.classes" %>
<%@ Import Namespace="NUtility" %>
<%@ OutputCache Location="None" VaryByParam="None" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
internal bool YtConfigParser(string videoID, out string html)
{
    DateTime start = DateTime.Now;
    Logger.Info("YouTube Web: Start of YtConfigParser");
    html = string.Empty;

    Logger.Info("YouTube Web: Creating StreamerPost");

    StreamerPost streamt = new StreamerPost();
    Logger.Info("YouTube Web: StreamerPost created.");
    if (videoID == "InitializeOnly") return true;
    streamt.Url = "https://www.youtube.com/watch?v=" + videoID;
    streamt.Type = StreamerPost.PostTypeEnum.Get;
    Logger.Info("YouTube Web: StreamerPost sending request.");
    string s1t = streamt.Post();

    Logger.Info("YouTube Web: StreamerPost completed.");

    Logger.Info("YouTube Web: Searching for ytplayer.config.");

    System.Text.RegularExpressions.Match m = new System.Text.RegularExpressions.Regex("ytplayer\\.config(.+)(?=;)").Match(s1t);
    if (!m.Success)
    {
           Logger.Info("YouTube Web: Unable to parse player config.");
        html = "<div" + " id='status-message'>Unable to parse player config.</" + "div>";
        return false;
    }
    Logger.Info("YouTube Web: ytplayer.config found.");

    string ytconfig = m.Value.Substring(0, m.Value.IndexOf("};") + 1);

    System.Text.RegularExpressions.MatchCollection matches = System.Text.RegularExpressions.Regex.Matches(ytconfig, @"(?<=s=)[A-Z0-9]+\.[A-Z0-9]+");
    if (matches.Count > 0)
    {
        Logger.Info("YouTube Web: Encrypted signatures detected.");
        System.Text.RegularExpressions.Match m2 = new System.Text.RegularExpressions.Regex("(?<=\"js\": \")[^\"]+").Match(s1t);
        if (!m2.Success)
        {
            Logger.Info("YouTube Web: Unable to find signature decryption script.");
            html = "<div" + " id='status-message'>Unable to find signature decryption script.</" + "div>";
            return false;
        }

        Logger.Info("YouTube Web: Getting signatures decryption script.");
        string jsScript;
        string scriptFolder = HttpContext.Current.Request.PhysicalApplicationPath.Replace("\\", "\\\\") + "public\\youtube\\scripts\\";
        string file = scriptFolder + Path.GetFileName(m2.Value.Replace("\\",string.Empty));
        Logger.Info("YouTube Web: Checking for local copy: " + file);
        if (!File.Exists(file))
        {
            streamt.Url = "http:" + m2.Value.Replace("\\", string.Empty);
            streamt.Type = StreamerPost.PostTypeEnum.Get;
            Logger.Info("YouTube Web: " + streamt.Url);
            jsScript = streamt.Post();
            try
            {
                if (!Directory.Exists(scriptFolder))
                    Directory.CreateDirectory(scriptFolder);
                File.WriteAllText(file, jsScript);
            }
            catch
            {
                Logger.Error("YouTube Web: Could not cache script.");
            }
        }
        else
        {
            jsScript = File.ReadAllText(file);
        }
        Logger.Info("YouTube Web: Script retrieval complete.");

        m2 = new System.Text.RegularExpressions.Regex(@"set..signature..(?<name>[$a-zA-Z]+)\([^)]\)").Match(jsScript);
        if (!m2.Success)
        {
            Logger.Info("YouTube Web: Unable to determine signature decryption function.");
            html = "<div" + " id='status-message'>Unable to determine signature decryption function.</" + "div>";
            return false;
        }
        string decodeFunction = m2.Groups["name"].Value;

        html = "<div" + " id='status-message'>Encrypted</" + "div>";
        // Remove outer function() wrapper
        string nScript = jsScript.Remove(0, jsScript.IndexOf('{') + 1);
        nScript = nScript.Remove(nScript.LastIndexOf('}'));
        html += "<script language='javascript'>\r\n\t" + nScript + "\r\n</" + "script>\r\n";

        html += "<div id='ytconfig'>" + ytconfig + "</div>\r\n";
        foreach (System.Text.RegularExpressions.Match match in matches)
        {
            html += "<script language='javascript'>var str1='s=" + match.Value + "';";
            html += "var str2='sig=' + " + decodeFunction + "('" + match.Value + "');";
            html += "document.getElementById('ytconfig').innerHTML = document.getElementById('ytconfig').innerHTML.replace(str1, str2);";
            html += "</" + "script>\r\n";
        }
    }
    else
    {
        html = "<div" + " id='status-message'>Unencrypted</" + "div>";
        html += "<div id='ytconfig'>" + ytconfig + "</div>\r\n";
    }
    TimeSpan t = DateTime.Now - start;
    Logger.Info("YouTube Web: Parsing completed in " + t.TotalMilliseconds + "ms");
    return true;
}
</script>
<html>
    <head>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title></title>
    </head>
<body>
<%
    string videoID = Request.Params["v"];

    // test video
    if (String.IsNullOrEmpty(videoID)) videoID = "z8dwNrNnFx4"; // "nUb9wa5OsJI1";

    try
    {
        Logger.Info("YouTube Web: Calling parser");
        string html;
        bool b = YtConfigParser(videoID, out html);
        Logger.Info("YouTube Web: Return from parser");
        Logger.Info("YouTube Web: Writing Response");
        try
        {
           Response.Write("<div" + " id='status'>");
           Response.Write(b ? "Success" : "Fail");
           Response.Write("</div>");
           Response.Write(html);
        }
        catch (Exception e)
        {
            Logger.Info("YouTube Web: Crash:  Error writing response: " + e);
            Response.Write("<div" + " id='status'>Fail</" + "div>");
            Response.Write("<div" + " id='status-message'>" + e.Message + "</" + "div>");
        }
    }
    catch (Exception e)
    {
        Logger.Info("YouTube Web: Crash:  Error in UpdateDecodeSig call: " + e);
        Response.Write("<div id='status'>Fail</div>");
        Response.Write("<div" + " id='status-message'>" + e.Message + "</" + "div>");
    }
%>
</body>
</html>
« Next Oldest | Next Newest »

Users browsing this thread: 3 Guest(s)

Pages (65): « Previous 1 … 55 56 57 58 59 … 65 Next »
Jump to page 


Possibly Related Threads…
Thread Author Replies Views Last Post
  Using R5000-HD with Network Recorder Plugin checkbin99 255 50,018 2021-08-24, 07:50 PM
Last Post: checkbin99
  how to configure RemoteRecorder Plugin to use remote NextPVR instance? bm_00 5 3,069 2020-10-06, 12:32 PM
Last Post: mvallevand
  Connecting NVPR to Emby Plugin NVPR Geek 0 1,331 2018-06-10, 12:32 AM
Last Post: NVPR Geek
  Newb here: Can someone help with a Plex Plugin issue? wepham 1 3,192 2017-02-07, 07:10 AM
Last Post: petenshari
  System Plugin Confused by New NPVR Naming Scheme Lao Pan 1 2,702 2016-09-25, 08:26 AM
Last Post: imilne
  Movies2 Plugin Problem... Anyone using it? ga_mueller 5 4,420 2016-08-22, 07:02 PM
Last Post: ga_mueller
  Plex Plugin Nikkie300 4 6,151 2016-01-24, 05:59 PM
Last Post: Nikkie300
  NextPVR Plex plugin, no live TV ajmast 15 9,548 2015-10-29, 03:45 AM
Last Post: ajmast
  Cant restart record service using System plugin on 3.4.8 shaunpatrick77 3 2,800 2015-05-19, 02:20 PM
Last Post: imilne
  Files Plugin crashes when there is an ' in the file name. cbgifford 89 28,876 2015-01-28, 05:19 AM
Last Post: mvallevand

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode