예제 #1
0
        private List <IMusicList> GetMydiss(IEnumerable <JToken> enumerable)
        {
            List <IMusicList> musics = new List <IMusicList>();

            foreach (var tk in enumerable)
            {
                String subtitle      = Convert.ToString(tk.SelectToken("subtitle"));
                String disstid       = Convert.ToString(tk.SelectToken("dissid"));
                var    tempmusiclist = new MusicList_QQ
                {
                    authorname = this.userinfo.name,
                    avatarUrl  = Convert.ToString(tk.SelectToken("picurl")),
                    disstid    = disstid,
                    name       = Convert.ToString(tk.SelectToken("title")),
                    subtitle   = subtitle,
                    dirid      = Convert.ToString(tk.SelectToken("dirid")),
                    songcount  = ExtractMethod.GetResult(ExtractType.Regex, subtitle, "(\\d+)首", new RegexPam {
                        Group = 1
                    }),
                    playtimes = ExtractMethod.GetResult(ExtractType.Regex, subtitle, "(\\d+)次播放", new RegexPam {
                        Group = 1
                    }),
                    musicListType = MusicListType.Owner
                };
                tempmusiclist.musics = GetMusic(disstid, Convert.ToInt32(tempmusiclist.songcount));

                musics.Add(tempmusiclist);
            }
            return(musics);
        }
예제 #2
0
        static void Main(string[] args)
        {
            int i = 1;
            //标准头
            HttpItem item = new HttpItem();

            item.URL           = $"https://hz.meituan.com/meishi/pn{i}/";
            item.Postdata      = "";
            item.UserAgent     = "Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.04";
            item.Referer       = "";
            item.ContentType   = "application/x-www-form-urlencoded; charset=UTF-8";
            item.Accept        = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
            item.Cookie        = "";
            item.ProxyIp       = "";
            item.ProxyUserName = "";
            item.ProxyPwd      = "";
            item.Method        = "GET";
            //自定义头
            item.Header.Add("Accept-Encoding", "gzip, deflate");
            String html = HttpMethod.HttpWork(item).Html;
            //Console.WriteLine(html);
            var poiId1 = ExtractMethod.GetResults(ExtractType.Regex, html, "\"poiId\":(\\d+),", new RegexPam {
                Group = 1
            });
            var poiId = RegexMethod.GetMutResult("\"poiId\":(\\d+),", html, 1);

            //Console.WriteLine(poiId1);

            Console.ReadLine();
        }
예제 #3
0
 static void WriteItOut(ExtractMethod extractMethod)
 {
     foreach (string word in extractMethod(title, 5))
     {
         Console.WriteLine(word);
     }
 }
예제 #4
0
        //我喜欢部分
        private IEnumerable <IMusicList> GetMymusic(IEnumerable <JToken> enumerable)
        {
            List <IMusicList> musics = new List <IMusicList>();

            foreach (var tk in enumerable)
            {
                String subtitle      = Convert.ToString(tk.SelectToken("subtitle"));
                String disstid       = Convert.ToString(tk.SelectToken("id"));
                var    tempmusiclist = new MusicList_QQ
                {
                    authorname = this.userinfo.name,
                    avatarUrl  = Convert.ToString(tk.SelectToken("picurl")),
                    disstid    = disstid,
                    name       = Convert.ToString(tk.SelectToken("title")),
                    subtitle   = subtitle,
                    songcount  = ExtractMethod.GetResult(ExtractType.Regex, subtitle, "(\\d+)首", new RegexPam {
                        Group = 1
                    }),
                };
                if (tempmusiclist.disstid.Equals("0"))
                {
                    continue;
                }
                tempmusiclist.musics = GetMusic(disstid, Convert.ToInt32(tempmusiclist.songcount));

                musics.Add(tempmusiclist);
            }
            return(musics);
        }
        public override void GetUserInfo()
        {
            //获取用户昵称 id 头像
            var result_home = HttpMethod.HttpWork(new HttpItem {
                URL = "https://music.163.com/", Cookie = logininfo.cookie
            });

            if (result_home.StatusCode == System.Net.HttpStatusCode.OK)
            {
                String html_home = result_home.Html;
                String userid    = ExtractMethod.GetResult(ExtractType.Regex, html_home, "userId:(\\d+)", new RegexPam {
                    Group = 1
                });
                this.userinfo = new UserInfo_163
                {
                    userid_163 = userid,
                    image      = ExtractMethod.GetResult(ExtractType.Regex, html_home, "avatarUrl:\"(.+?)\"", new RegexPam {
                        Group = 1
                    }),
                    name = ExtractMethod.GetResult(ExtractType.Regex, html_home, "nickname:\"(.+?)\"", new RegexPam {
                        Group = 1
                    }),
                    platform   = PlatformType.Music163,
                    musicLists = GetMusicList(userid)
                };
                String text = JsonConvert.SerializeObject(this.userinfo);
            }
        }
예제 #6
0
 static void Main3(string[] args)
 {
     using (var stream = File.OpenRead("SCAN - Orion Constellation Sicav-RAIF SCA - SPRO-Searchable.pdf"))
     {
         var pdfReader = new PdfReader(stream, null, null, ExtractMethod.SimpleLines());
         pdfReader.Read(new PdfVisitor());
     }
 }
예제 #7
0
    public static void Main()
    {
        // Instantiate delegate to reference ExtractWords method
        ExtractMethod extractMeth = ExtractWords;
        string        title       = "The Scarlet Letter";

        // Use delegate instance to call ExtractWords method and display result
        foreach (string word in extractMeth(title, 5))
        {
            Console.WriteLine(word);
        }
    }
        /// <summary>
        /// 歌单详情
        /// </summary>
        /// <param name="musiclist_id">歌单id</param>
        /// <param name="songcount">歌曲数</param>
        /// <returns></returns>
        private List <IMusicInfo> GetMusic(String musiclist_id, int songcount)
        {
            List <IMusicInfo> musicInfos = new List <IMusicInfo>();
            HttpItem          item       = new HttpItem
            {
                URL       = $"https://music.163.com/#/playlist?id={musiclist_id}",
                UserAgent = UA,
                //小于6条不需要登录  不传cookie
                Cookie = songcount > 6 ? logininfo.cookie : String.Empty
            };
            var result_playlist = HttpMethod.HttpWork(item);

            if (result_playlist.StatusCode == System.Net.HttpStatusCode.OK)
            {
                String html = result_playlist.Html;
                var    data = ExtractMethod.GetResult(ExtractType.Xpath, html, "//*[@id=\"song-list-pre-data\"]");
                var    gs   = ExtractMethod.GetResult(ExtractType.Xpath, html, "/html/body/div[3]/div/div/div/div/div/img", new XpathPam {
                    Attr = "data-key"
                });
                var bqi4m = ExtractMethod.GetResult(ExtractType.Xpath, html, "//*[@id=\"song-list-pre-cache\"]/ul/li/a", new XpathPam {
                    Attr = "href"
                });
                String listjson = HttpMethod.HttpWork(new HttpItem
                {
                    URL      = "http://127.0.0.1:8001/api/",
                    Method   = "POST",
                    Postdata = JsonConvert.SerializeObject(new { data, gs, bqi4m })
                }).Html;
                if (JsonConvert.DeserializeObject(listjson) is JArray jarr)
                {
                    foreach (var tk in jarr)
                    {
                        var musicid_163 = Convert.ToString(tk.SelectToken("id"));
                        musicInfos.Add(new MusicInfo_163
                        {
                            name         = Convert.ToString(tk.SelectToken("name")),
                            musicid_163  = musicid_163,
                            singers      = GetSingers(tk.SelectTokens("ar[*]")),
                            album        = Convert.ToString(tk.SelectToken("al.name")),
                            albumid_163  = Convert.ToString(tk.SelectToken("al.id")),
                            albumpic_163 = Convert.ToString(tk.SelectToken("al.picUrl")),
                            time         = TimeConverter.ToMinSecond(tk.SelectToken("dt")),
                            songStatue   = GetStatue(Convert.ToString(tk.SelectToken("pv.st")), Convert.ToString(tk.SelectToken("fee")))
                        });
                    }
                }
            }
            else
            {
                throw new Exception("获取歌单详情失败");
            }
            return(musicInfos);
        }
 public AssetGHParameterAttribute(Type param,
                                  string name, string nickname, string description,
                                  GH_ParamAccess access = GH_ParamAccess.item,
                                  ExtractMethod method  = ExtractMethod.ValueOnly,
                                  bool modifiable       = true,
                                  bool optional         = true)
 {
     ParamType     = param;
     Name          = name;
     NickName      = nickname;
     Description   = description;
     ParamAccess   = access;
     ExtractMethod = method;
     Modifiable    = modifiable;
     Optional      = optional;
 }
		static bool VariableExists (ExtractMethod.VariableLookupVisitor visitor, string name)
		{
			foreach (var descriptor in visitor.Variables.Values) {
				if (descriptor.Name == name)
					return true;
			}
			return false;
		}
예제 #11
0
        static void ExplicitlyDefineADelegate()
        {
            ExtractMethod extractMethod = ExtractWords;

            WriteItOut(extractMethod);
        }
 private object processValue(string customerName, string value, ExtractMethod subProcess = null)
 {
     if (subProcess != null)
     {
         return subProcess(customerName, value);
     }
     else
     {
         return value;
     }
 }
예제 #13
0
 public PdfRowsValuesProviderArgs SetExtractMethod(ExtractMethod extractMethod)
 {
     this.ExtractMethod = extractMethod;
     return(this);
 }