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
#591
2015-01-24, 11:01 AM
jksmurf Wrote:Thanks.

1. It plays the video, but only with very sporadic sound.
Try pausing and letting it buffer a little more.
jksmurf Wrote:2. I can see the buffered file grow, but it is not saved? In your old Youtube versions, the saved versions played locally. Is it possible to reinstate that?
I don't think it keeps the file any longer because the plan was to implement "Recording" instead but I never got around to that. I can add the option to save the file.
jksmurf Wrote:3. What does disabling the script caching actually do please? Does it keep the local ts file?
Disabling the script cache just means it won't cache the javascript from the youtube page locally. The javascript holds the signature decryption functions. When the algorithm changes, the script has to be re-cached.
macgyver
Offline

Member

Posts: 189
Threads: 32
Joined: Jun 2005
#592
2015-01-26, 10:58 AM
whurlston Wrote:Did you move the new youtube.dll from "Plugin" to "Plugins"? I made a mistake when packaging it.

Ah, no. But I have now!
Many thanks.
Dual Pentium 1.8GHz, 4GB, 5TB, Colossus, NOVA-T, NOVA-HD-S2, W10, Latest NPVR 4, 3 PCH A100, 2 PCH A110
macgyver
Offline

Member

Posts: 189
Threads: 32
Joined: Jun 2005
#593
2015-01-26, 12:27 PM
macgyver Wrote:Ah, no. But I have now!
Many thanks.

Spoke slightly too soon, it worked for some (from a channel) but now I'm getting IE script errors for others (from a search). Could it be because I'm still running XP, and therefore IE8?
Dual Pentium 1.8GHz, 4GB, 5TB, Colossus, NOVA-T, NOVA-HD-S2, W10, Latest NPVR 4, 3 PCH A100, 2 PCH A110
whurlston
Offline

Posting Freak

Posts: 7,885
Threads: 102
Joined: Nov 2006
#594
2015-01-26, 01:49 PM
Did you also move the NExtUtility.dll? I forgot to mention that
macgyver
Offline

Member

Posts: 189
Threads: 32
Joined: Jun 2005
#595
2015-01-27, 12:53 PM
It's looking pretty good now thanks, but I do still sometimes get a load of IE Scripts errors and then:
YouTube: Could not buffer video: The remote server returned an error: (403) Forbidden
These are typically music videos.
I have disabled script caching and restarted.
I just tried searching 'Rosie Vela' (remember her?) and playing pretty much any of the vids (eg Magic Smile) fails as above.
Dual Pentium 1.8GHz, 4GB, 5TB, Colossus, NOVA-T, NOVA-HD-S2, W10, Latest NPVR 4, 3 PCH A100, 2 PCH A110
whurlston
Offline

Posting Freak

Posts: 7,885
Threads: 102
Joined: Nov 2006
#596
2015-01-27, 07:23 PM
Found the problem; I had to modify my regex slightly because of a missing space in the website. Replace your parser.aspx with the following (this also adds a variable "UseScriptCaching" near the top of the file to make enabling/disabling the script caching easier):

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)
{
    [COLOR="#FF0000"][B]// Change this to "true" to cache signature decryption scripts.
    bool UseScriptCaching = false;[/B][/COLOR]

    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.");
    // File.WriteAllText(HttpContext.Current.Request.PhysicalApplicationPath.Replace("\\", "\\\\") + "public\\youtube\\htmldump.txt", s1t);

    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\"[\\s]*:[\\s]*\"(?<jscript>[^\"]+)").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: " + m2.Groups["jscript"].Value);
        string jsScript;
        string scriptFolder = HttpContext.Current.Request.PhysicalApplicationPath.Replace("\\", "\\\\") + "public\\youtube\\scripts\\";
        string file = scriptFolder + Path.GetFileName(m2.Groups["jscript"].Value.Replace("\\",string.Empty));
        if (!File.Exists(file) || !UseScriptCaching)
        {
            Logger.Info("YouTube Web: Checking for local copy: " + file);
            streamt.Url = "http:" + m2.Groups["jscript"].Value.Replace("\\", string.Empty);
            streamt.Type = StreamerPost.PostTypeEnum.Get;
            Logger.Info("YouTube Web: " + streamt.Url);
            jsScript = streamt.Post();
            if (UseScriptCaching)
            {
                Logger.Info("YouTube Web: Saving local copy of signature decryption script");
                try
                {
                    if (!Directory.Exists(scriptFolder))
                        Directory.CreateDirectory(scriptFolder);
                    File.WriteAllText(file, jsScript);
                }
                catch
                {
                    Logger.Error("YouTube Web: Could not cache script.");
                }
            }
        }
        else
        {
            Logger.Info("YouTube Web: Reading local copy of signature decryption script");
            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>
Reddwarf
Offline

Posting Freak

Posts: 6,629
Threads: 230
Joined: Mar 2007
#597
2015-01-28, 07:38 AM
Should we all replace parser.aspx?

"I'd rather have a bottle in front of me than a frontal lobotomy"
jksmurf
Offline

Posting Freak

HK (DMBTH)
Posts: 3,590
Threads: 410
Joined: Jul 2005
#598
2015-01-28, 10:56 AM
whurlston Wrote:Try pausing and letting it buffer a little more..
Tried that - even with new parser in post #596, I get a repeating error as below. Video plays a while but no sound. Then bails out. I am not able to locate MP42TSConverter either?
whurlston Wrote:I don't think it keeps the file any longer because the plan was to implement "Recording" instead but I never got around to that. I can add the option to save the file..
That would be great thanks.
whurlston Wrote:Disabling the script cache just means it won't cache the javascript from the youtube page locally. The javascript holds the signature decryption functions. When the algorithm changes, the script has to be re-cached.
OK Cheers.


Code:
2015-01-28 18:46:56.363    [DEBUG][1]    GetDuration returning 129
2015-01-28 18:46:56.469    [DEBUG][1]    GetDuration returning 129
2015-01-28 18:46:56.581    [DEBUG][1]    GetDuration returning 129
2015-01-28 18:46:56.688    [DEBUG][1]    GetDuration returning 129
2015-01-28 18:46:56.733    [DEBUG][1]    GetEventCode() returned: 0x0001
2015-01-28 18:46:56.733    [DEBUG][1]    About to store playback position information
2015-01-28 18:46:56.733    [DEBUG][1]    GetDuration returning 129
2015-01-28 18:46:56.733    [DEBUG][1]    PlaybackPositionHelper.StorePlaybackPosition(fYP-3q22too.ts, 129, 129)
2015-01-28 18:46:56.733    [DEBUG][1]    PlaybackPositionHelper.DeletePlaybackPosition(D:\GBPVRLiveTVBuffer\YouTube\fYP-3q22too.ts)
2015-01-28 18:46:56.744    [DEBUG][1]    Stopping graph@1
2015-01-28 18:46:56.779    [DEBUG][12]    MP42TSConverter: Could not update progress. Probably couldn't parse ffmpeg frame number:
frame= 2247 fps= 56 q=-1.0 size=   14345kB time=74.63 bitrate=1574.7kbits/s    
   at System.Globalization.TimeSpanParse.ProcessTerminal_HM(TimeSpanRawInfo& raw, TimeSpanStandardStyles style, TimeSpanResult& result)
   at System.Globalization.TimeSpanParse.ProcessTerminalState(TimeSpanRawInfo& raw, TimeSpanStandardStyles style, TimeSpanResult& result)
   at System.Globalization.TimeSpanParse.TryParseTimeSpan(String input, TimeSpanStandardStyles style, IFormatProvider formatProvider, TimeSpanResult& result)
   at System.Globalization.TimeSpanParse.Parse(String input, IFormatProvider formatProvider)
   at System.TimeSpan.Parse(String s)
   at NExtUtility.FFMpeg.Progress..ctor(TimeSpan expectedDuration, String input, Boolean isCancelled)
2015-01-28 18:46:56.970    [DEBUG][1]    Stopping graph@2
2015-01-28 18:46:56.979    [DEBUG][1]    Stopping graph@3
2015-01-28 18:46:56.986    [DEBUG][1]    Removing filter  NPVR CC Dump
2015-01-28 18:46:56.986    [DEBUG][1]    Removing filter  EVR Renderer
2015-01-28 18:46:56.988    [DEBUG][1]    Removing filter  NPVR PES Collector (Teletext)
2015-01-28 18:46:56.988    [DEBUG][1]    Removing filter  EAC3 Audio Renderer
2015-01-28 18:46:56.988    [DEBUG][1]    Removing filter  NPVR PES Collector (DVBSubs)
2015-01-28 18:46:56.989    [DEBUG][1]    Removing filter  MPEG1 Audio Renderer
2015-01-28 18:46:56.989    [DEBUG][1]    Removing filter  AC3 Audio Renderer
2015-01-28 18:46:56.989    [DEBUG][1]    Removing filter  AAC Audio Renderer
2015-01-28 18:46:56.989    [DEBUG][1]    Removing filter  Line 21 Decoder
2015-01-28 18:46:57.306    [DEBUG][12]    MP42TSConverter: Could not update progress. Probably couldn't parse ffmpeg frame number:
frame= 2271 fps= 55 q=-1.0 size=   14619kB time=75.60 bitrate=1584.1kbits/s    
   at System.Globalization.TimeSpanParse.ProcessTerminal_HM(TimeSpanRawInfo& raw, TimeSpanStandardStyles style, TimeSpanResult& result)
   at System.Globalization.TimeSpanParse.ProcessTerminalState(TimeSpanRawInfo& raw, TimeSpanStandardStyles style, TimeSpanResult& result)
   at System.Globalization.TimeSpanParse.TryParseTimeSpan(String input, TimeSpanStandardStyles style, IFormatProvider formatProvider, TimeSpanResult& result)
   at System.Globalization.TimeSpanParse.Parse(String input, IFormatProvider formatProvider)
   at System.TimeSpan.Parse(String s)
   at NExtUtility.FFMpeg.Progress..ctor(TimeSpan expectedDuration, String input, Boolean isCancelled)
2015-01-28 18:46:57.853    [DEBUG][10]    MP42TSConverter: Could not update progress. Probably couldn't parse ffmpeg frame number:
frame= 2296 fps= 55 q=-1.0 size=   14740kB time=76.09 bitrate=1586.9kbits/s    
   at System.Globalization.TimeSpanParse.ProcessTerminal_HM(TimeSpanRawInfo& raw, TimeSpanStandardStyles style, TimeSpanResult& result)
   at System.Globalization.TimeSpanParse.ProcessTerminalState(TimeSpanRawInfo& raw, TimeSpanStandardStyles style, TimeSpanResult& result)
   at System.Globalization.TimeSpanParse.TryParseTimeSpan(String input, TimeSpanStandardStyles style, IFormatProvider formatProvider, TimeSpanResult& result)
   at System.Globalization.TimeSpanParse.Parse(String input, IFormatProvider formatProvider)
   at System.TimeSpan.Parse(String s)
   at NExtUtility.FFMpeg.Progress..ctor(TimeSpan expectedDuration, String input, Boolean isCancelled)
2015-01-28 18:46:57.990    [DEBUG][1]    Removing filter  LAV Audio Decoder 0003
2015-01-28 18:46:57.990    [DEBUG][1]    Removing filter  LAV Audio Decoder 0002
2015-01-28 18:46:57.990    [DEBUG][1]    Removing filter  LAV Audio Decoder 0001
2015-01-28 18:46:57.990    [DEBUG][1]    Removing filter  LAV Audio Decoder
2015-01-28 18:46:57.992    [DEBUG][1]    Removing filter  Microsoft DTV-DVD Video Decoder
2015-01-28 18:46:58.001    [DEBUG][1]    Removing filter  MPEG-2 Demultiplexer
2015-01-28 18:46:58.002    [DEBUG][1]    Removing filter  NPVR TS Reader2
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 |
macgyver
Offline

Member

Posts: 189
Threads: 32
Joined: Jun 2005
#599
2015-01-28, 11:37 AM
[quote=whurlston]Found the problem; I had to modify my regex slightly because of a missing space in the website. Replace your parser.aspx with the following (this also adds a variable "UseScriptCaching" near the top of the file to make enabling/disabling the script caching easier):

Hmmm, doesn't appear to have made any difference - I still get the IE errors and then 403. Double-checked parser, deleted IE cache, restarted.
Anything else I need to clear/reset?

Logs: [ATTACH=CONFIG]39603[/ATTACH]

[ATTACH=CONFIG]39602[/ATTACH]
Dual Pentium 1.8GHz, 4GB, 5TB, Colossus, NOVA-T, NOVA-HD-S2, W10, Latest NPVR 4, 3 PCH A100, 2 PCH A110
mvallevand
Online

Posting Freak

Ontario Canada
Posts: 53,016
Threads: 956
Joined: May 2006
#600
2015-01-28, 12:13 PM
The last time I put on a new player I had to restart the recording server to see changes.

Marti
« Next Oldest | Next Newest »

Users browsing this thread: 3 Guest(s)

Pages (65): « Previous 1 … 58 59 60 61 62 … 65 Next »
Jump to page 


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