Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 64434cf

Browse files
update readme, add footer, use new mongodb data format
1 parent 90eaa62 commit 64434cf

File tree

8 files changed

+78
-31
lines changed

8 files changed

+78
-31
lines changed

‎BagAndDrag/README.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# BagAndDrag
22
Bag and Drag
33

4-
[original repo](https://github.com/tgbot-collection/BagAndDrag)
4+
[original repo](https://github.com/tgbot-collection/BagAndDrag)
5+
6+
打包带走:-)

‎README.md‎

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
**由于译名的不同,建议输入部分译名,然后从列表中进行选择。比如说想看权力的游戏第四季,那么直接搜索"权力的游戏"就可以了。**
2121

22-
# Cloudflare Worker
22+
# 资源分享站
2323
[点此访问](https://yyets.dmesg.app/)
2424

2525
# 命令
@@ -40,7 +40,7 @@ yyets_offline - 人人影视离线数据
4040
![](assets/1.png)
4141

4242
## 资源分享站截图
43-
目前使用的是我的 Cloudflare Worker Site
43+
~~目前使用的是我的 Cloudflare Worker Site~~
4444

4545
![](assets/2.png)
4646

@@ -55,7 +55,9 @@ yyets_offline - 人人影视离线数据
5555

5656
## 常规方式
5757
### 1. 环境
58-
推荐使用Python 3.6+,需要安装redis `apt install redis`,根据个人情况可以使用virtualenv
58+
推荐使用Python 3.6+,环境要求
59+
* redis
60+
* 可选MongoDB
5961
```bash
6062
pip install -r requirements.py
6163
```
@@ -69,22 +71,31 @@ pip install -r requirements.py
6971
* MAINTAINER:维护者的Telegram UserID
7072
* REDIS:redis的地址,一般为localhost
7173
* MONGODB: mongodb的地址
74+
### 3. 导入数据(可选)
75+
如果使用yyets,那么需要导入数据到MongoDB。可以在将数据导入到MySQL之后使用如下脚本导入数据到MongoDB
76+
```shell
77+
python3 web/prepare/convert_db.py
78+
```
79+
**不再兼容旧版本数据**
7280

73-
### 3. 运行
81+
### 4. 运行
7482
```bash
7583
python /path/to/YYeTsBot/yyetsbot/bot.py
7684
```
77-
### 4. systemd 单元文件
85+
### 5. systemd 单元文件
7886
参考 `yyets.service`
7987

88+
### 网站部署运行方式
89+
参考 `worker``web`目录下的 `README`
90+
8091
# TODO
8192
- [x] 添加对FIX的支持
8293
- [x] 文件/函数重命名,类化
8394
- [x] 优先字幕组顺序设置 - 动态设置
8495
- [x] 添加个人喜好搜索
8596
- [x] 整理fix资源:初步完成
97+
- [x] 独立网站
8698
- [ ] test case...啊不想写
87-
- [ ] 独立网站
8899

89100

90101
# 归档资源下载
@@ -113,7 +124,7 @@ python /path/to/YYeTsBot/yyetsbot/bot.py
113124
觉得本项目对你有帮助?你可以通过以下方式表达你的感受:
114125

115126
* 感谢字幕组
116-
* 点一个🌟
127+
* 点一个🌟和fork🍴
117128
* 宣传,使用,提交问题报告
118129
* 收藏[我的博客](https://dmesg.app/)
119130
* 捐助我,[给我买杯咖啡?](https://www.buymeacoffee.com/bennythink)

‎web/README.md‎

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,17 @@
55
* tornado
66
* mongodb
77
* pymongo
8+
* cryptography
89

9-
# metrics
10-
* 总榜:直接查询
11-
* 月榜:记录当月id,每月清空
12-
* 周榜:
10+
# 导入数据
11+
**注意:不兼容channel中分享的MongoDB数据**
12+
暂时没有现成到数据,一个workaround如下:
13+
1. 下载MySQL数据,[戳我查看详情](https://t.me/mikuri520/668)
14+
1. 导入数据到MySQL
15+
2. 运行 `python prepare/convert_db.py`
16+
17+
# 运行
18+
`python server.py`
19+
20+
# Docker
21+
参考[这里](https://github.com/BennyThink/WebsiteRunner)

‎web/index.html‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@
6161
<h1>人人影视下载分享</h1>
6262
<h1>By Benny</h1>
6363
<br>
64-
<h2>本站数据库<b><a style="text-decoration: none;color: skyblue" href="https://t.me/mikuri520/668">永久开源免费</a></b>,请不要做无意义的爬虫
64+
<h2>本站数据库<b><a style="text-decoration: none;color: skyblue" href="https://t.me/mikuri520/668">永久开源免费</a></b>,<abbr
65+
style="text-decoration: none" title="你也爬不下来啊">请不要做无意义的爬虫</abbr>
6566
</h2>
66-
<h2><a style="text-decoration: none;color: deepskyblue" href="https://t.me/yyets_bot">这个 Telegram Bot</a>
67-
里去使用,或者使用下方搜索框</h2>
67+
6868
<form action="search.html">
6969
<label>
7070
<input name="kw" type="text">
@@ -75,8 +75,14 @@ <h2>在 <a style="text-decoration: none;color: deepskyblue" href="https://t.me/y
7575
<div id="tv">
7676
<h2>大家都在看......</h2>
7777
</div>
78-
<h2>有问题联系 <a style="text-decoration: none;color: green" href="https://t.me/BennyThink">Benny小可爱</a></h2>
79-
78+
<hr>
79+
<h2>相关资源</h2>
80+
<h3>
81+
联系我 <a style="text-decoration: none;color: green" href="https://t.me/BennyThink">Benny 小可爱</a>
82+
YYeTs 机器人<a style="text-decoration: none;color: green" href="https://t.me/yyets_bot">Telegram Bot</a>
83+
开源 <a style="text-decoration: none;color: green" href="https://github.com/tgbot-collection/YYeTsBot">GitHub</a>
84+
我的博客 <a style="text-decoration: none;color: green" href="https://dmesg.app/">土豆不好吃</a>
85+
</h3>
8086
</div>
8187
</body>
8288
<script src="js/axios.min.js"></script>

‎web/resource.html‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,9 @@
433433
<textarea id="copyArea" style="display: none; width: 1px; height: 1px"></textarea>
434434
<div class="ui-footer ui-footer-simple" style="visibility: hidden" id="footer">
435435
<div class="copyright">
436-
<p>最帅的分享站 2017 <a href="https://t.me/mikuri520">@BennyThink</a></p>
436+
<p>最帅的分享站 2017 <a href="https://t.me/mikuri520">BennyThink</a> @
437+
<a href="https://dmesg.app/">土豆不好吃</a>
438+
</p>
437439
</div>
438440
</div>
439441
<div class="hidden"></div>

‎web/search.html‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,13 @@ <h2>在 <a style="text-decoration: none;color: deepskyblue" href="https://t.me/y
6363
<div id="tv">
6464
</div>
6565
<hr>
66-
<h2>有问题请联系 <a style="text-decoration: none;color: green" href="https://t.me/BennyThink">Benny小可爱</a></h2>
66+
67+
<h3>
68+
联系我 <a style="text-decoration: none;color: green" href="https://t.me/BennyThink">Benny 小可爱</a>
69+
YYeTs 机器人<a style="text-decoration: none;color: green" href="https://t.me/yyets_bot">Telegram Bot</a>
70+
开源 <a style="text-decoration: none;color: green" href="https://github.com/tgbot-collection/YYeTsBot">GitHub</a>
71+
我的博客 <a style="text-decoration: none;color: green" href="https://dmesg.app/">土豆不好吃</a>
72+
</h3>
6773
</div>
6874
</body>
6975
<script src="js/axios.min.js"></script>

‎worker/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Cloudflare Worker部署方式
2-
**This worker will be deprecated.**
2+
**This worker is deprecated. No further updates from now on.**
33

44
## 1. 安装wrangler等工具
55
[Cloudflare Docs](https://developers.cloudflare.com/workers/cli-wrangler)

‎yyetsbot/fansub.py‎

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -205,22 +205,29 @@ def __get_share_page(self):
205205
class YYeTsOffline(YYeTsBase):
206206
label = "yyets offline"
207207

208-
def __init__(self, db="yyets", col="resource"):
208+
def __init__(self, db="zimuzu", col="yyets"):
209209
super().__init__()
210210
self.mongo = pymongo.MongoClient(host=MONGO)
211211
self.collection = self.mongo[db][col]
212212

213213
def search_preview(self, search_text: str) -> dict:
214214
logging.info("[%s] Loading offline data from MongoDB...", self.label)
215-
regex = re.compile(search_text, re.IGNORECASE)
216-
condition = {"name": {"$regex": regex}}
217-
data = self.collection.find(condition)
218215

216+
projection = {'_id': False, 'data.info': True}
217+
data = self.collection.find({
218+
"$or": [
219+
{"data.info.cnname": {'$regex': f'.*{search_text}.*'}},
220+
{"data.info.enname": {'$regex': f'.*{search_text}.*'}},
221+
{"data.info.aliasname": {'$regex': f'.*{search_text}.*'}},
222+
]},
223+
projection
224+
)
219225
results = {}
220226
for item in data:
221-
fake_url = "http://www.rrys2020.com/resource/{}".format(item["id"])
227+
info = item["data"]["info"]
228+
fake_url = "http://www.rrys2020.com/resource/{}".format(info["id"])
222229
url_hash = hashlib.sha1(fake_url.encode('u8')).hexdigest()
223-
results[url_hash] = item["name"].replace("\n", " ")
230+
results[url_hash] = info["cnname"] +info["enname"] +info["aliasname"]
224231
self.redis.hset(url_hash, mapping={"class": self.__class__.__name__, "url": fake_url})
225232

226233
logging.info("[%s] Offline search complete", self.label)
@@ -230,11 +237,10 @@ def search_preview(self, search_text: str) -> dict:
230237
def search_result(self, resource_url) -> dict:
231238
# yyets offline
232239
self.url = resource_url
233-
234-
data: dict = self.collection.find_one({"url": self.url})
235-
rid = data["id"]
236-
name = data["data"]["data"]["info"]["cnname"]
237-
data.pop("_id")
240+
# http://www.rrys2020.com/resource/10017
241+
rid = self.url.split("/resource/")[1]
242+
data: dict = self.collection.find_one({"data.info.id": int(rid)}, {'_id': False})
243+
name = data["data"]["info"]["cnname"]
238244
self.data = {"all": data, "share": WORKERS.format(id=rid), "cnname": name}
239245
return self.data
240246

@@ -349,3 +355,8 @@ def class_to_tg(sub_class: str):
349355
m = getattr(this_module, sub_name)
350356
logging.info("Mapping %s to %s", cmd_name, m)
351357
vars()[cmd_name] = m
358+
359+
if __name__ == '__main__':
360+
a = YYeTsOffline()
361+
v = a.search_preview("逃避")
362+
print(v)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /