/// <summary>
        /// 爆淘宝联盟的链接-根据淘宝官方跳转js解析算法
        /// 使用postman  发送淘宝客链接可以得到这个算法
        /// </summary>
        /// <param name="encryUrl"></param>
        public static string GetTaobaoUnionOfficalUrl(string encryUrl)
        {
            //示范:下面为淘宝客加密的链接--从一淘过来的
            //string url = "http://s.click.taobao.com/t?spm=1002.8113010.1999451596.1.197829d2jvKq9J&e=m%3D2%26s%3Dxx7h3yvW%2FlwcQipKwQzePOeEDrYVVa64szgHCoaJEBXomhrxaV0k4ZAA5CqNKnVlalBUWfSYtdXqadVuhJq1oW37Sy0WpaHc0S8eIUiNHrwNztF5RF%2BnklwTri0BQMnX1tZRX7Kk0roGkzEdSUwZLhvt%2FrpwP7nD09XRW5e8YPIgsgo%2FaWiDiMYl7w3%2FA2kb";

            var httpHelper     = new HttpRequestHelper();
            var requestHeaders = new NameValueCollection();

            requestHeaders.Add("Host", "s.click.taobao.com");
            requestHeaders.Add("Upgrade-Insecure-Requests", "1");
            var resp = httpHelper.CreateGetHttpResponse(encryUrl, requestHeaders);//.// new Http.CookedHttpClient().Client.GetStringAsync(url).Result;

            string tuUrl = resp.ResponseUri.AbsoluteUri;

            string realUrl = TaobaoWebPageService.ConvertTaobaoKeUrlToRealUrl(tuUrl);


            requestHeaders.Add("Referer", tuUrl);
            var resp2 = httpHelper.CreateGetHttpResponse(realUrl, requestHeaders, 50000);

            string carshedUrl = resp2.ResponseUri.AbsoluteUri;

            return(carshedUrl);
        }
Пример #2
0
        /// <summary>
        /// 根据不同的平台类型
        /// 创建对应平台的蜘蛛实例
        /// 工厂分支
        /// </summary>
        /// <param name="platform"></param>
        /// <returns></returns>
        public static BaseWebPageService CreateWebPageService(SupportPlatformEnum platform)
        {
            BaseWebPageService webPageService = null;

            switch (platform)
            {
            case SupportPlatformEnum.Tmall:
                webPageService = new TmallWebPageService();
                break;

            case SupportPlatformEnum.Taobao:
                webPageService = new TaobaoWebPageService();
                break;

            case SupportPlatformEnum.Jingdong:
                webPageService = new JingdongWebPageService();
                break;

            case SupportPlatformEnum.Pdd:
                webPageService = new PddWebPageService();
                break;

            case SupportPlatformEnum.Vip:
                webPageService = new VipWebPageService();
                break;

            case SupportPlatformEnum.Guomei:
                webPageService = new GuomeiWebPageService();
                break;

            case SupportPlatformEnum.Suning:
                webPageService = new SuningWebPageService();
                break;

            case SupportPlatformEnum.Dangdang:
                webPageService = new DangdangWebPageService();
                break;

            case SupportPlatformEnum.Yhd:
                webPageService = new YhdWebPageService();
                break;

            //case SupportPlatformEnum.Meilishuo:
            //    webPageService = new MeilishuoWebPageService();
            //    break;
            case SupportPlatformEnum.Mogujie:
                webPageService = new MogujieWebPageService();
                break;

            //case SupportPlatformEnum.Zhe800:
            //    webPageService = new Zhe800WebPageService();
            //    break;
            case SupportPlatformEnum.ETao:
                webPageService = new ETaoWebPageService();
                break;

            default:
                break;
            }

            return(webPageService);
        }