惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

aimingoo的专栏
aimingoo的专栏
博客园 - 三生石上(FineUI控件)
GbyAI
GbyAI
大猫的无限游戏
大猫的无限游戏
M
MIT News - Artificial intelligence
Microsoft Azure Blog
Microsoft Azure Blog
月光博客
月光博客
Engineering at Meta
Engineering at Meta
I
InfoQ
T
Tailwind CSS Blog
N
Netflix TechBlog - Medium
S
SegmentFault 最新的问题
H
Help Net Security
博客园 - 【当耐特】
WordPress大学
WordPress大学
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
美团技术团队
博客园 - 叶小钗
T
The Blog of Author Tim Ferriss
腾讯CDC
雷峰网
雷峰网
Martin Fowler
Martin Fowler
The GitHub Blog
The GitHub Blog
D
Docker

博客园 - 小熊吉米

国密 SM2 / SM3 / SM4 静态帮助类 Windows10禁用资源管理器文件夹自动视图转换 Avalonia跨平台智能提问ChatAI C#使用WhisperNet实现语音识别功能 WPF日历控件 百度网盘搜索工具_2022 Vue+ElementUI: 手把手教你做一个audio组件 VSCode最佳设置 进程守护工具 【C#】工具类-FTP操作封装类FTPHelper C# 调用APlayer教程 网盘搜索网站 在线服务 在线转换服务 Windows下安装NTP服务器 FFmpeg命令详解 C#远程桌面连接工具 Win10远程桌面出现 身份验证错误,要求的函数不受支持,这可能是由于CredSSP加密Oracle修正 解决方法 LINQ的左连接、右连接、内连接 MongoDB的下载、安装与部署方法
百度网盘搜索工具_2019
小熊吉米 · 2019-09-03 · via 博客园 - 小熊吉米

百度网盘搜索工具

1.写在前面

经常搜索百度网盘里的资源,以前做了个数据来源来自盘多多,现在不能使用了。所以就又找了一个搜索网站史莱姆http://www.slimego.cn。

2.分析

通过获得查询页面的源数据,得到记录总数,分页数,搜索数据集合。

3.程序实现

下面将贴出实现该程序的关键代码。

 1         /// <summary>
 2         /// 通过正则表达式获得百度网盘文件
 3         /// </summary>
 4         private void GetNetFilesDo()
 5         {
 6             string Keyword = TextBoxKeyword.Text.Trim();
 7             string url = string.Format("http://www.slimego.cn/search.html?q={0}&page=1&rows=20", Keyword);
 8             string html = GetHtmlContent(url);
 9 
10             //获得总页数和总记录数
11             GetPageInfo(html);
12             Invoke(new SetProgressMaxDelegate(SetProgressMax), RecordCount);
13             if (RecordCount <= 0)
14             {
15                 Invoke(new SetButtonStartDelegate(SetButtonStart), true);
16                 return;
17             }
18 
19             //循环页面
20             for (int i = 1; i <= PageCount; i++)
21             {
22                 if (i >= 2)//第1页已经查到了,就不用查了
23                 {
24                     url = string.Format("http://www.slimego.cn/search.html?q={0}&page={1}&rows=20", Keyword, i);
25                     html = GetHtmlContent(url);
26                 }
27 
28                 int seeks = html.IndexOf("<div style=\"display:table\">");//开始位置
29                 int seeke = html.IndexOf("<div id=\"pagesplit\" class=\"m-pagination\"></div>");//结束位置
30                 string content = html.Substring(seeks + 0, seeke - seeks - 15).Trim();
31                 Regex rxGetInfo = new Regex("<div style=\"display: table-cell\" class=\"searchCell\">.*?</div>", RegexOptions.Singleline);
32                 MatchCollection matches = rxGetInfo.Matches(content);
33 
34                 //循环每1页
35                 for (int j = 0; j < matches.Count; j++)
36                 {
37                     if (matches[j].Success)
38                     {
39                         string strMatch = matches[j].Value;
40 
41                         MatchCollection match1 = Regex.Matches(strMatch, "<a rel=\"noreferrer\".*?</a>", RegexOptions.Singleline);//文件名
42                         MatchCollection match2 = Regex.Matches(strMatch, "<span class=\"ftype\">.*?</span>");//类别
43                         MatchCollection match3 = Regex.Matches(strMatch, "<span class=\"size\">.*?</span>");//大小
44                         MatchCollection match4 = Regex.Matches(strMatch, "<span class=\"upload\">.*?</span>");//时间
45                         MatchCollection match5 = Regex.Matches(strMatch, "<a rel=\"noreferrer\".*?</a>", RegexOptions.Singleline);//文件地址
46                         MatchCollection match6 = Regex.Matches(strMatch, "<span class=\"home\">.*?</span>", RegexOptions.Singleline);//分享地址
47                         if (match1 == null || match2 == null || match3 == null || match4 == null || match5 == null || match6 == null) continue;
48 
49 
50                         NetFileInfo file = new NetFileInfo();
51                         file.ID = (i - 1) * PageSize + j + 1;
52                         file.FileFullName = CommonLib.RemoveHTML(match1[0].Value).Trim();
53                         file.FileName = file.FileFullName;
54                         file.ExtName = GetExtName(file.FileFullName);
55                         file.Tag = GetTypeName(file.ExtName);
56                         file.FileSize = CommonLib.RemoveHTML(match3[0].Value);
57                         string TimeSize = CommonLib.RemoveHTML(match4[0].Value);//上传: 2018年07月20日 07时27分
58                         TimeSize = TimeSize.Substring(TimeSize.IndexOf(" ") + 1, TimeSize.LastIndexOf(" ") - 4);
59                         file.FileTime = TimeSize;
60                         file.ShareFileSite = GetShareFileSite(match1[0].Value);
61                         string ShareName = CommonLib.RemoveHTML(match6[0].Value).Replace("查看用户", "").Replace("的所有分享", "");
62                         file.ShareName = ShareName;
63                         file.ShareSite = GetShareSite(match6[0].Value);
64 
65                         Invoke(new GridRowAddDelegate(GridRowAdd), file);
66                         Invoke(new SetProgressDelegate(SetProgress), file.ID);
67                     }
68                 }
69             }
70 
71             Invoke(new SetButtonStartDelegate(SetButtonStart), true);
72         }

View Code

4.程序界面

百度网盘搜索工具

5.功能

1、搜索任意名称的百度网盘共享文件。
2、鼠标左键双击打开网盘地址。
3、鼠标右键点击弹出上下文菜单。打开、复制网盘地址及打开、复制分享者主页。
4、可以导出搜索结果。

下载地址:https://pan.baidu.com/s/16RidPx2VLn7CCUHcQ-aPCw