Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[改善] 增加替代站 #13

Open
FlandreDaisuki opened this issue Mar 28, 2018 · 8 comments
Open

[改善] 增加替代站 #13

FlandreDaisuki opened this issue Mar 28, 2018 · 8 comments
Labels
discussion enhancement New feature or request

Comments

@FlandreDaisuki
Copy link
Owner

因為 dmhy 有時候怪怪的會造成各式各樣的 error
想把像是 ACG.RIP 這種站作為替代方案 (Promise.race)
將 crawler.js 改成 abstract class (想想需要哪些 functions)

crawlers
├── base.js
├── dmhy.js
└── acg-rip.js

torrent 轉 magnet 可以用 webtorrent/parse-torrent

@FlandreDaisuki FlandreDaisuki added enhancement New feature or request good first issue Good for newcomers discussion labels Mar 28, 2018
@maple3142
Copy link
Contributor

我覺得這樣的話可能要弄一個獨立的選項來指定來源網站,例如 --source dmhy|acgrip

@FlandreDaisuki
Copy link
Owner Author

不,這樣就失去替代的目的了,就是要全部都去跑,但是只挑最快 fulfilled 的來操作

dmhy = new dmhyCrawler()
acgrip = new acgripCrawler()
xxx = new xxxCrawler()
const fastest = Promise.race([dmhy, acgrip, xxx].map(cr => cr.fetchThreads(subscription)))
fastest.其他動作()

@maple3142
Copy link
Contributor

那要如何處理 search 的功能?
也用 race 又不太對吧

@FlandreDaisuki
Copy link
Owner Author

倒是真的沒想到 search 的問題 ww
看來真的需要一個多一個參數,可能的作法是 search 那邊多個 --source 的 option
順便也把 source 加進 config 裡面,如果 search 沒指定就用這邊的

update 好像也可以 race
download 可以 race

@maple3142
Copy link
Contributor

acgrip 和 dmhy 的動畫應該不完全相同吧,除了判斷標題以外也沒辦法確定兩邊是否完全一樣

@FlandreDaisuki
Copy link
Owner Author

是不完全一樣,但比較大的字幕組都已經兩邊(或更多)放了。
還是你有想到會造成嚴重錯誤的情況,還沒做出來實驗我也不確定會有什麼情況w

@Inndy
Copy link

Inndy commented Mar 30, 2018

做個 abstract layer,開放大家自己寫 plugin 來做呢?

@FlandreDaisuki
Copy link
Owner Author

FlandreDaisuki commented Mar 30, 2018

@Inndy 這個我有想過,我寫完之後有發現一個專案在做類似但更厲害的東西 RicterZ/BGmi
他是允許刻一個 py 檔當作 plugin 去爬 (以會寫程式的人作為客群)

一般人當對象的話,可以用 ini 這種設定檔
或也可以像他提供一個 class 讓會寫的人自己接
不過要做到這個大概需要重寫整個架構了... 所以還沒做 🙈

@FlandreDaisuki FlandreDaisuki removed the good first issue Good for newcomers label Mar 30, 2018
@FlandreDaisuki FlandreDaisuki mentioned this issue Mar 31, 2018
25 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants