⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 getinfo.cs

📁 可以抓取淘宝上的所有商家信息 一般情况下可以把商家信息抓取后
💻 CS
字号:
using System;
using System.Data;

namespace BaseInfo
{
	/// <summary>
	/// GetInfo 的摘要说明。
	/// </summary>
	public class GetInfo
	{
		public GetInfo()
		{
			
		}
		
		public static void SetType(string type)
		{
			BaseInfo.DataFun df=new DataFun();
			string sql="select * from T_TYPE_INFO where Type='"+type+"'";
			DataView dv=df.dataView(sql);
			if(dv.Count>0)
			{
				return;
			}
			else
			{
				sql="insert into T_TYPE_INFO(Type) values('"+type+"')";
				df.EXEC(sql);
			}
		}

		public static string[] GetAllList(string webInfo)
		{
			string[] newStr=new string[100];
			int lenNum=0;
			int len=webInfo.IndexOf("掌柜");
			while(len>=0)
			{
				webInfo=webInfo.Substring(len+2);
				len=webInfo.IndexOf("<a");
				if(len>0)
				{
					webInfo=webInfo.Substring(len+3);
					len=webInfo.IndexOf(">");
					webInfo=webInfo.Substring(len+1);
					len=webInfo.IndexOf("<");
					newStr[lenNum++]=webInfo.Substring(0,len);
					
				}

				len=webInfo.IndexOf("掌柜");
			}
			return newStr;

		}

		public static string[] GetAllList2(string webInfo)
		{
			string[] newStr=new string[100];
			int lenNum=0;
			int len=webInfo.IndexOf("掌柜");
			while(len>=0)
			{
				webInfo=webInfo.Substring(len+2);
				len=webInfo.IndexOf("<a");
				if(len>0)
				{
					webInfo=webInfo.Substring(len+3);
					len=webInfo.IndexOf(">");
					webInfo=webInfo.Substring(len+1);
					len=webInfo.IndexOf("<");
					newStr[lenNum++]=webInfo.Substring(0,len);
					
				}

				len=webInfo.IndexOf("掌柜");
			}
			return newStr;

		}

		public static bool SetUser(string type,string userInfo)
		{
			BaseInfo.DataFun df=new DataFun();
			string sql="select * from T_USER where UserName='"+userInfo+"'";
			DataView dv=df.dataView(sql);
			if(dv.Count>0)
			{
				return false;
			}
			else
			{
				sql="insert into T_USER(MainMenu,UserName,Status) values('"+type+"','"+userInfo+"',1)";
				df.EXEC(sql);
				return true;
			}
		}

		public static bool SetUser2(string type,string userInfo)
		{
			BaseInfo.DataFun df=new DataFun();
			string sql="select * from T_USER2 where UserName='"+userInfo+"'";
			DataView dv=df.dataView(sql);
			if(dv.Count>0)
			{
				return false;
			}
			else
			{
				sql="insert into T_USER2(MainMenu,UserName,Status) values('"+type+"','"+userInfo+"',1)";
				df.EXEC(sql);
				return true;
			}
		}

		public static string[] GetAllGoods(string webInfo)
		{
			string[] newStr=new string[100];
			int lenNum=0;
			int len=webInfo.IndexOf("auction1.taobao.com/auction/item_");
			while(len>=0)
			{
				webInfo=webInfo.Substring(len);
				len=webInfo.IndexOf("\"");
				if(len>0)
				{
					newStr[lenNum++]="http://"+webInfo.Substring(0,len);
					
				}
				webInfo=webInfo.Substring(len+2);
				len=webInfo.IndexOf("auction1.taobao.com/auction/item_");
			}
			return newStr;

		}

	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -