Ejemplo n.º 1
0
        public override bool Suitable(string url)
        {
            GILState(true);

            if (MatchString != null)
            {
                dynamic re = PythonScope.Import("re");
                return(re.match(MatchString, url) != null);
            }

            return((extractorInstance as dynamic).suitable(url));
        }
Ejemplo n.º 2
0
        public override void Initialize()
        {
            if (extractorInstance == null)
            {
                GILState(true);

                YTDLPyBridge pyBridge        = new YTDLPyBridge(ytdl);
                var          pythonYoutubeDL = (PythonYoutubeDLModule as dynamic)(pyBridge.ToPython());

                dynamic sys = PythonScope.Import("sys");
                sys.path.insert(0, AppDomain.CurrentDomain.BaseDirectory);

                dynamic ext     = PythonScope.Import(Module);
                dynamic ieClass = (ext as PyObject).GetAttr(Name);

                extractorInstance = ieClass(pythonYoutubeDL);
            }
        }
Ejemplo n.º 3
0
        public string MatchId(string url)
        {
            GILState(true);

            if (MatchString != null)
            {
                dynamic re    = PythonScope.Import("re");
                dynamic match = re.match(MatchString, url);
                if (match == null)
                {
                    return(null);
                }
                string id1 = (string)match.group("id");
                if (id1 != null)
                {
                    return(id1);
                }
                string id2 = (string)match.group(2);
                return(id2);
            }

            return((string)(extractorInstance as dynamic)._match_id(url));
        }