Skip to content
This repository has been archived by the owner on Apr 10, 2022. It is now read-only.

update #66

Open
wants to merge 71 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
17d583b
基本功能
xiandanin Mar 9, 2018
387f443
调整取链接
xiandanin Mar 9, 2018
a6b0cb9
调整忽略目录
xiandanin Mar 9, 2018
6b4c18e
说明
xiandanin Mar 9, 2018
3460f7e
Update README.md
xiandanin Mar 9, 2018
5d2a327
Update README.md
xiandanin Mar 9, 2018
6e6d312
修改说明
xiandanin Mar 9, 2018
5b924c6
删除多余文件
xiandanin Mar 9, 2018
2622cec
调整下顺序
xiandanin Mar 9, 2018
7df3078
增加失效反馈的超链接
xiandanin Mar 16, 2018
b327fa3
调整响应内容
xiandanin May 15, 2018
12dd496
调整了Web UI
xiandanin May 16, 2018
6353003
新增两个站
xiandanin May 16, 2018
384ba17
更新说明
xiandanin May 16, 2018
af9b9d4
修改描述
xiandanin May 16, 2018
c645ec3
更换截图
xiandanin May 16, 2018
713841b
增加统计
xiandanin May 16, 2018
3447e59
增加回到顶部;跳源站详情
xiandanin May 18, 2018
5cb6cd5
修改a标签区域
xiandanin May 18, 2018
8c51afc
新增一个网站
xiandanin Jun 7, 2018
033f64e
增加两个站
xiandanin Jul 1, 2018
68614d9
版本
xiandanin Jul 1, 2018
cbe0ee2
更新了规则
xiandanin Jul 21, 2018
510c6d9
列表请求方式换成post
xiandanin Sep 14, 2018
f323994
增加标题高亮
xiandanin Nov 19, 2018
b026bca
删除失效的源站
xiandanin Nov 26, 2018
7d61bf1
增加2个站
xiandanin Nov 26, 2018
1dec0e8
增加排序功能
xiandanin Jan 23, 2019
28fb932
更新截图
xiandanin Jan 23, 2019
d8e930f
2.x初步
xiandanin Apr 23, 2019
8dc7c57
完善2.0Java部分
xiandanin May 5, 2019
2a27cc1
完善2.0页面
xiandanin May 6, 2019
2ed16f4
增加几个源站
xiandanin May 6, 2019
c1860a5
完善2.0文档
xiandanin May 7, 2019
73b11af
调整样式
xiandanin May 7, 2019
0185267
不蒜子元素验证
xiandanin May 7, 2019
6aa0d1d
版本链接新窗口打开
xiandanin May 7, 2019
a3b4f06
更换部分服务端渲染为vue渲染
xiandanin May 7, 2019
a9388ce
修复根目录是子路径时URL出现异常的问题
xiandanin May 8, 2019
179cc8c
Jsoup设置默认SslSocketFactory
xiandanin May 8, 2019
b37a13e
Update issue templates
xiandanin May 8, 2019
7f263dd
Update issue templates
xiandanin May 8, 2019
37b8c5a
Update issue templates
xiandanin May 8, 2019
0e51102
Update issue templates
xiandanin May 8, 2019
7de7b49
优化页面
xiandanin May 8, 2019
d6be4cd
路径跳转编码,防止乱码
xiandanin May 8, 2019
a65faf8
调整日志文件规则
xiandanin May 9, 2019
7b56816
修复日志在windows乱码的问题
xiandanin May 9, 2019
1c639eb
Update README.md
xiandanin May 10, 2019
d890290
Update README.md
xiandanin May 10, 2019
107f19b
新增 BitTorrent Trackers
xiandanin May 21, 2019
d0dfeee
更新说明
xiandanin May 21, 2019
69eb8c1
删除bom
xiandanin May 21, 2019
8265c95
Tracker按钮换成复制
xiandanin May 22, 2019
d88b759
增加转换mac规则的api
xiandanin May 24, 2019
b6e74de
输出mac规则增加是否格式化的选项
xiandanin May 24, 2019
4e9eeee
更新规则
xiandanin May 24, 2019
dceae24
调整缓存策略,降低访问源站的频率;
xiandanin May 27, 2019
3dde04a
更新版本号
xiandanin May 27, 2019
d8356c1
关键字高亮兼容大小写
xiandanin May 27, 2019
6e1d2ba
Update README.md
xiandanin Jun 1, 2019
f3e7733
Update README.md
xiandanin Jun 1, 2019
0c62116
Update README.md
xiandanin Jun 1, 2019
093d4df
兼容源站较多的情况
xiandanin Jun 3, 2019
92f9669
Update rule.json
xiandanin Jun 5, 2019
d42819f
Update rule.json
xiandanin Jun 5, 2019
1a35ce5
更新截图
xiandanin Jun 18, 2019
b94f56b
更新截图
xiandanin Jun 18, 2019
2895d0b
更新规则;
xiandanin Jun 21, 2019
c8d930b
Create stale.yml
xiandanin Jun 22, 2019
880af3b
Update stale.yml
xiandanin Jun 22, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE/issue_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
name: issue_template
about: 默认/通用
title: ''
labels: ''
assignees: ''

---

> 操作系统版本:
>
> 磁力搜版本:
>
> 问题描述:
>
> 异常日志(如果有):
33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE/issue_template_submit_source.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: issue_template_submit_source
about: 贡献网站
title: ''
labels: enhancement
assignees: ''

---

网站名称:

网站地址:

抓取规则

```
{
"site": ,
"proxy":,
"group": ,
"magnet": ,
"name": ,
"size": ,
"date": ,
"hot": ,
"url": ,
"paths": {
"time": ,
"size": ,
"hot":
}
}
```
15 changes: 15 additions & 0 deletions .github/ISSUE_TEMPLATE/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 7
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- pinned
- security
# Label to use when marking an issue as stale
staleLabel: wontfix
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: false
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: >
此问题长时间无活动,已被自动关闭
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
target
.idea
147 changes: 147 additions & 0 deletions Config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@

* [自定义配置](#自定义配置)
* [规则说明](#规则说明)
* [获取XPath](#获取XPath)
* [API](#API)
* [代理配置](#代理配置)

## 自定义配置
配置文件在`main/resources/config.properties`下,修改配置后需要重新启动项目

```
project.version=${project.version}

#管理密码 32位小写MD5值
admin.password.md5=

#规则json文件地址(支持URL和本地路径)本地路径以main/resources为根目录
#修改规则后 访问重载规则API可热刷新配置
//rule.json.uri=rule.json
rule.json.uri=https://raw.githubusercontent.com/dengyuhan/magnetW/master/src/main/resources/rule.json

#搜索框占位文字
search.placeholder=钢铁侠
#版本号链接(点击版本号要跳转的链接)
version.link=
#是否开启预加载(开启后会异步缓存下一页,加快下一页的访问速度但会增加性能消耗)
preload.enabled=true

#是否开启tracker服务器 开启后会在新增一列拼接了tracker服务器列表的磁力链接
trackers.enabled=true
#自动更新tracker列表的间隔时间(单位:小时)
#列表来自https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_all.txt
trackers.update.interval.hour=24

#不蒜子统计
#是否开启
busuanzi.enabled=false
#是否在页面上显示(当busuanzi.enabled=true生效)
busuanzi.show=false

#是否忽略需要代理才能访问的源站
proxy.ignore=true
#HTTP代理服务器配置
proxy.enabled=false
proxy.host=127.0.0.1
proxy.port=1087
```

## 规则说明
规则Json支持本地文件和网络文件,基于XPath

```
{
"site": "CiLiWiKi", //网站名称
"proxy": false, //该网站是否需要代理才能访问
"group": "//*[@id=\"wall\"]/div[2]/div", //Item容器XPath
"magnet": "./div[1]/h3/a/@href", //磁力链XPath
"name": "./div[1]/h3/a", //显示名称XPath
"size": "./div[3]/span[2]/b", //文件大小XPath
"date": "./div[3]/span[5]/b", //创建时间XPath
"hot": "./div[3]/span[4]/b", //人气热度XPath
"url": "https://www.ciliwiki.com", //网站首页
"paths": { //搜索路径
"preset": "/search/%s-%d.html", //默认排序
"time": "/search/%s-%d-time.html", //时间排序
"size": "/search/%s-%d-size.html", //大小排序
"hot": "/search/%s-%d-views.html" //人气排序
}
}
```

## 获取XPath
#### group
选中列表其中一个Item,右键元素即可复制这个Item的XPath,示例中选中的是第5个,所以XPath是`//*[@id="wall"]/div[2]/div[5]`,把索引去掉并转义,所以最终是`//*[@id=\"wall\"]/div[2]/div`

![](screenshots/1.png)

控制台用`$x("//*[@id=\"wall\"]/div[2]/div")`测试,打印出列表说明XPath正确

<img src="screenshots/2.png" width="400"/>

#### magnet | name | size | date | hot
以显示名称为例,选中包含名称的元素,复制出来的XPath是这样`//*[@id="wall"]/div[2]/div[5]/div[1]/h3/a`,因为每个属性都是在group下查找的,所以要把**group的部分去掉**在前面加`.`,**name**的XPath应该是`./div[1]/h3/a`

![](screenshots/3.png)

<img src="screenshots/4.png" width="400"/>

## API
### 管理API
可以去[在线MD5](http://tool.chinaz.com/tools/md5.aspx)将密码转成32位小写,然后在`config.properties`中填入MD5,即可访问管理API

<img src="screenshots/6.png" width="700"/>

```
admin.password.md5=529ca8050a00180790cf88b63468826a
```

<img src="screenshots/7.png" width="400"/>


##### 重载规则

```
/api/reload?p=[管理密码]
```
##### 清除缓存

```
/api/clear-cache?p=[管理密码]
```

### 数据API
支持返回数据JSON,可以用来扩展其它平台

##### 获取源站列表
```
api/source
```

##### 搜索
```
api/search?source=[源站名称]&keyword=[关键字]&sort=[排序类型]&page=[页码]
```

## 代理配置
这里以Mac端的SS为例,其它端请自行Google

1.开启HTTP代理

<img src="screenshots/8.jpg" width="300"/>

2.在配置文件中填入地址和端口

```
proxy.ignore=false
proxy.enabled=true
proxy.host=127.0.0.1
proxy.port=1087
```
3.重启项目生效

#### 其它说明
1. Linux的SS大多为服务端,这里需要的是客户端,注意不要用错;
2. 用的是HTTP代理的端口而不是Socket代理;
3. 如果是PAC模式,一定要把源站的域名加到PAC里并重启SS;
4. 要确保你的代理是能访问到源站的,可以通过浏览器是否能够打开源站来验证。
36 changes: 35 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,35 @@
# magnetW
## 示例站点
[http://bt.xiandan.in](http://bt.xiandan.in)

示例站点所用图标来自[iconfont](https://www.iconfont.cn)
__示例站点访问速度较慢,并且很不稳定,最好自行搭建__

## 快速搭建
在[Releases](https://github.com/dengyuhan/magnetW/releases)下载编译好的`war`包,发布到`Tomcat`即可。

>部分平台提供了一键启动版
>Windows:下载[magnetw-windows-2.x.x.zip](https://github.com/dengyuhan/magnetW/releases),解压即可用
>Mac:下载[magnetw-mac-2.x.x.zip](https://github.com/dengyuhan/magnetW/releases),解压即可用

## 截图
![](screenshots/5.gif)

## 其它版本
> Mac版:[magnetX](https://github.com/youusername/magnetX)
>
> 小程序:
> <img src="screenshots/mini.jpg" width="150"/>

## 2.0特性
#### 2.0改动巨大,不支持从1.x升级到2.x,旧版请谨慎使用
>1. 规则文件支持本地文件和网络文件
>2. 支持自定义配置
>3. 支持多种排序
>4. 增加流量统计
>5. 增加搜索预加载
>6. 增加数据API
>7. 增加管理API
>8. 支持Tracker服务器

## 其它说明
自定义配置和规则可以看[Config.md](Config.md)
100 changes: 100 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>in.xiandan</groupId>
<artifactId>magnetw</artifactId>
<packaging>war</packaging>
<version>2.0.6</version>
<name>magnetW</name>
<url>http://maven.apache.org</url>
<dependencies>

<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.11.3</version>
</dependency>
<dependency>
<groupId>net.sourceforge.htmlcleaner</groupId>
<artifactId>htmlcleaner</artifactId>
<version>2.21</version>
</dependency>


<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.2</version>
</dependency>

<!--jstl-->
<dependency>
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>jstl-api</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>

<!-- jsp -->
<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>


<!--spring-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.3.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>4.3.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>4.3.1.RELEASE</version>
</dependency>


<!--缓存-->
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>2.10.4</version>
</dependency>
</dependencies>
<build>
<finalName>magnetw</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
</project>
Binary file added screenshots/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/5.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/8.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/mini.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshots/zanshang.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading