Baidu:C#利用百度来搜索网页、图片、视频等等
来源:互联网 发布:电视棒软件安卓版 编辑:程序博客网 时间:2024/04/30 18:59
我们可以不用每次都先进入百度主页,然后输入关键词,然后点击搜索。直接做一个控制台程序,打开搜索页面就OK了。
【网通】点击此处下载全部源程序
【下载说明】
1、单击上面这个地址,打开下载页面。
2、点普通下载--等待30秒--点“下载”按钮--保存
主要源程序:
// Author: PJusing System;using System.Web;using System.Diagnostics;namespace QhCSharp{class Program{public static void Main(string[] args){if( args.Length == 0 ){Process.Start("http://www.baidu.com");}else if( args.Length == 1 ){Process.Start("http://www.baidu.com/s?wd=" + args[0]);}else if( args.Length == 2 ){string searchType = args[0].ToLower();if( searchType == "news" ){Process.Start("http://news.baidu.com/ns?word=" + HttpUtility.UrlEncode(args[1],System.Text.Encoding.GetEncoding("GB2312")));}else if( searchType == "web" ){Process.Start("http://www.baidu.com/s?wd=" + HttpUtility.UrlEncode(args[1],System.Text.Encoding.GetEncoding("GB2312")));}else if( searchType == "mp3" ){Process.Start("http://mp3.baidu.com/m?word=" + HttpUtility.UrlEncode(args[1],System.Text.Encoding.GetEncoding("GB2312")));}else if( searchType == "image" ){Process.Start("http://image.baidu.com/i?word=" + HttpUtility.UrlEncode(args[1],System.Text.Encoding.GetEncoding("GB2312")));}else if( searchType == "video" ){Process.Start("http://video.baidu.com/v?word=" + HttpUtility.UrlEncode(args[1],System.Text.Encoding.GetEncoding("GB2312")));}else if( searchType == "wenku" ){Process.Start("http://wenku.baidu.com/search?word=" + HttpUtility.UrlEncode(args[1],System.Text.Encoding.GetEncoding("GB2312")));}else{Console.WriteLine("Unknown search type.");}}else{Console.WriteLine("Usage: Baidu <SearchType> <Keyword>");Console.WriteLine("SearchType:");Console.WriteLine("\tnews");Console.WriteLine("\tweb");Console.WriteLine("\tmp3");Console.WriteLine("\timage");Console.WriteLine("\tvideo");Console.WriteLine("\twenku");}}}}
【更多文章】
- [原]Hotkey.cs:为应用程序添加热键
- [原]GetAlpha:C#实现获取网页验证码图片,并识别出其中的字母
- [译]C#控制计算机的并口LPT
- [原]《The C Programming Language》电子书下载
- [原]ManageStartUpApps:C#操作注册表来读取和修改开机启动项
- [原]SeeFiles:C#查看和修改文件或目录所有属性的工具
- [原]ManageApps:C#读取Windows系统中的已经安装的程序并卸载软件
- [原]使用Excel的VBA来读取和修改bmp位图像素数据
- [原]QQHelper:QQ大家来找茬 辅助工具 外挂
- [原]IniFile.cs:C#来操作ini配置文件
- Baidu:C#利用百度来搜索网页、图片、视频等等
- C# 百度音乐搜索API利用
- 网页中嵌入Baidu搜索
- 网页中加入baidu搜索
- C# Asp.Net自动调用百度搜索页面baidu/google搜索页面
- 网页中嵌入Baidu、Google合并搜索
- 百度视频搜索
- 利用UIWebView显示pdf文件,网页等等
- 百度图片搜索api
- c#调用百度搜索
- 百度网页搜索查询参数
- 如何利用C#来生成带图片的二维码
- 网页图片飘起来
- 利用selenium 实现对百度图片搜索中的图片的抓取
- Baidu搜索
- 通过调用关键字来实现测试用例---重复利用百度搜索
- 网页搜索帮助-禁止搜索引擎收录的方法[来自baidu]
- JS----baidu、google 简搜索框嵌入网页代码
- 将Button的Enabled属性绑定到变量,并使两个不同Button的此属性互斥
- updateprogress用法
- Android 压缩Post请求数据
- 七夕怀念
- 都是奖学金惹的祸
- Baidu:C#利用百度来搜索网页、图片、视频等等
- 杂谈人生
- Oracle 知识点滴
- Linux C调用C++库
- Android之PreferenceActivity
- C++编程之内存和指针
- C/C++ 误区二:fflush(stdin)
- MSF命令小记
- 设计模式笔记之---观察者模式