Categories


Tags


抢先式多线程网络蜘蛛

  抢先式多线程网络蜘蛛

整理自网络ChatGPT产生之内容,文本内容不具备参考意义,程序内容及代码片段有且仅有借鉴意义。

  框架
//      Copyright(C) 2017 铭飞科技
//
#region 版权信息
/*
 * 此文件自 Copyright(C) 2008 - 2017 铭飞科技 Classification:无 开源网站:http://www.http://www. coding
 */
#endregion


using System;
using System.Data;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;


namespace Web.Templates.UI
{
    /// 
    /// 标签树控件
    /// 
    public class Tree : System.Web.UI.WebControls.TreeView
    {
        private string _styleName = "";

        /// 
        /// 样式
        /// 
        /// The name of the style.
        public string StyleName
        {
            get { return _styleName; }
            set { _styleName = value; }
        }

        private string _checkedValue = "";

        /// 
        /// 默认选中当前值
        /// 
        /// The checked value.
        public string CheckedValue
        {
            get { return _checkedValue; }
            set { _checkedValue = value; }
        }

        private string _checkBoxName = "";

        /// 
        /// 复选框名称
        /// 
        /// The check box name.
        public string CheckBoxName
        {
            get { return _checkBoxName; }
            set { _checkBoxName = value; }
        }

        private int _checkParentType = -1;

        /// 
        /// 
        /// 
        /// The type of the check parent.
        public int CheckParentType
        {
            get { return _checkParentType; }
            set { _checkParentType = value; }
        }

        private int _checkChildType = -1;

        /// 
        /// 
        /// 
        /// The type of the check child.
        public int CheckChildType
        {
            get { return _checkChildType; }
            set { _checkChildType = value; }
        }

        private string _showLevel = "999";

        /// 
        /// 显示层级
        /// 
        /// The show level.
        public string ShowLevel
        {
            get { return _showLevel; }
            set { _showLevel = value; }
        }

        private string _valueField = "id";

        /// 
        /// 编号字段名
        /// 
        /// The value field.
        public string ValueField
        {
            get { return _valueField; }
            set { _valueField = value; }
        }

        private string _textField = "title";

        /// 
        /// 显示字段名
        /// 
        /// The text field.
        public string TextField
        {
            get { return _textField; }
            set { _textField = value; }
        }

        private string _fatherField = "parentid";

        /// 
        /// 父编号字段名
        /// 
        /// The father field.
        public string FatherField
        {
            get { return _fatherField; }
            set { _fatherField = value; }
        }

        private TreeNodeBindEventHandler _onBind;

        /// 
        /// 构建事件
        /// 
        /// The on bind event.
        public event TreeNodeBindEventHandler OnBind
        {
            add { _onBind += value; }
            remove { _onBind -= value; }
        }

        private DataTable _dataSource;

        /// 
        /// 数据源
        /// 
        /// The data source.
        public DataTable DataSource
        {
            get { return _dataSource; }
            set { _dataSource = value; }
        }

        /// 
        /// 绑定数据
        /// 
        public override void DataBind()
        {
            this.Nodes.Clear();
            this.ShowCheckBox = this.CheckBoxName != "" && this.CheckBoxName != null;

            if (_dataSource != null)
            {
                TreeNode root_node = new TreeNode();
                root_node.Value = "-1";
                root_node.Text = "根目录";
                Nodes.Add(root_node);

                List root_list = new List();
                for (int i = 0; i < _dataSource.Rows.Count; i++)
                {
                    TreeNode node = new TreeNode();
                    DataRow dr = _dataSource.Rows[i];

                    node.Value = dr[_valueField].ToString();
                    node.Text = dr[_textField].ToString();
                    node.SelectAction = TreeNodeSelectAction.None;
                    //node.Depth =int.Parse(_showLevel);
                    if (_onBind != null)
                    {
                        _onBind(node);
                    }

                    if (dr[_fatherField].ToString() == "-1" || dr[_fatherField].ToString() == "0")
                    {
                        Nodes.Add(node);
                        if (node.Value == _checkedValue)
                        {
                            node.Checked = true;
                        }

                        int has = 0;
                        for (int j = 0; j < root_list.Count; j++)
                        {
                            if (root_list[j] == int.Parse(node.Value))
                            {
                                has = 1;
                            }
                        }
                        if (has == 0)
                        {
                            root_list.Add(int.Parse(node.Value));
                        }
                    }
                    else
                    {
                        TreeNode father_node = GetNode(root_node, dr[_fatherField].ToString());
                        if (father_node != null)
                        {
                            father_node.ChildNodes.Add(node);
                            if (node.Value == _checkedValue)
                            {
                                node.Checked = true;
                            }
                        }
                    }
                }
                //绑定事件,自动勾选父级节点
                if (this.CheckParentType == 0 || this.CheckChildType == 0)
                {
                    string enterjvice = "";
                    if (this.CheckParentType == 0)
                    {
                        enterjvice += "FatherChecked";
                    }
                    if (this.CheckChildType == 0)
                    {
                        enterjvice += "ChildChecked";
                    }
                    if (enterjvice != "" && this.Nodes.Count > 0)
                    {
                        this.Attributes.Add("onclick", "JscAutoCheckedNode(this,'" + enterjvice + "');");
                    }
                }
            }
            base.DataBind();
        }

        /// 
        /// 构建HTML
        /// 
        /// The  object that receives the server control content.
        protected override void Render(HtmlTextWriter writer)
        {
            string[] style_list = new string[] { "admin_tree", "data_tree", "input_tree", "menu_tree", "popmenu_tree" };
            switch (_styleName)
            {
                case "menu_tree":
                    this.ShowCheckBox = false;
                    this.CssClass += " menu";
                    break;
                case "popmenu_tree":
                    this.

Public @ 2023-02-24 22:24:01 整理自网络ChatGPT产生之内容,文本内容不具备参考意义,程序内容有且仅有借鉴意义。

搜狗spider的抓取频次是怎样的?

sogou spider 对于同一个 IP 地址的服务器主机,只建立一个连接,抓取间隔速度控制在几秒一次。一个网页被收录后,最快也要过几天以后才会去更新。如果持续不断地抓取您的网站,请注意您的网站上的网页是否每次访问都产生新的链接。如果您认为 sogou spider 对于您的网站抓取过快,请与我们联系,并最好能提供访问日志中sogou spider 访问的部分,而不要直接将搜狗spider的ua

Public @ 2017-08-18 15:38:49

网络爬虫(Spider)

网络爬虫(Spider)是一种自动化程序,用于通过互联网收集和抓取网页信息。它模拟人类在浏览器中的操作,自动访问网站并抓取其中的信息。爬虫的主要作用是帮助用户快速地获取海量数据,例如网页内容、图片、音频、视频等,并将它们存储在一个本地数据库中,以供后续处理和分析。在人工获取数据耗时费力的情况下,网络爬虫的应用可以大大提高数据抓取效率,以及提高数据处理的准确与可靠性。

Public @ 2023-06-02 04:00:09

蜘蛛抓取过程中涉及的网络协议有哪些

搜索引擎通过站长们提供资源,来满足用户的搜索需求,而站长通过搜索引擎将网站的内容传播出去,获得有效的流量和用户。蜘蛛在抓取过程中双方都要遵守一定的规范,便于搜索引擎抓取,不要使用过多对搜索引擎不友好的元素。蜘蛛抓取过程中涉及的网络协议有以下四种:1、HTTP协议HTTP是超文本传输协议,在互联网上被广泛应用的一种网络协议,客户端和服务器端请求和应答的标准。用户通过浏览器或蜘蛛等对指定端口发起一个请

Public @ 2012-07-29 16:22:31

Google爬行缓存代理(crawl caching proxy)

Google爬行缓存代理是指一个系统或应用程序,作为一种中间层,扮演缓存服务器的角色,将已抓取的网络页面存储在缓存中,等待后续的请求。在Google上,这个代理系统用于加速用户访问网站的过程,提高网站的响应速度,并减少搜索引擎爬虫的访问量。通过这种方式,Google能够有效地降低网站的负载,并利用缓存的内容来提高用户的搜索体验。Google的爬行缓存代理充分体现了其对网络性能和用户体验的重视,也是

Public @ 2023-04-02 07:00:11

更多您感兴趣的搜索

0.435995s