@nitrimandylis/flick 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/flick.js +16 -5
- package/man/flick.1 +1 -1
- package/package.json +1 -1
package/dist/flick.js
CHANGED
|
@@ -614,6 +614,10 @@ function parseYifyEnglish(html) {
|
|
|
614
614
|
}
|
|
615
615
|
return null;
|
|
616
616
|
}
|
|
617
|
+
function parseYifyZip(html) {
|
|
618
|
+
const link = html.match(/href="(\/subtitle\/[^"]+\.zip)"/);
|
|
619
|
+
return link ? link[1] : null;
|
|
620
|
+
}
|
|
617
621
|
async function fromYify(imdbId) {
|
|
618
622
|
const srt = join3(SUBS_DIR, `${imdbId}.srt`);
|
|
619
623
|
if (existsSync3(srt))
|
|
@@ -628,8 +632,15 @@ async function fromYify(imdbId) {
|
|
|
628
632
|
const slug = parseYifyEnglish(await page.text());
|
|
629
633
|
if (!slug)
|
|
630
634
|
return null;
|
|
631
|
-
const
|
|
632
|
-
|
|
635
|
+
const subPage = `${YIFY}/subtitles/${slug}`;
|
|
636
|
+
const detail = await fetch(subPage, { headers: { "User-Agent": UA }, signal: AbortSignal.timeout(15000) });
|
|
637
|
+
if (!detail.ok)
|
|
638
|
+
return null;
|
|
639
|
+
const zipLink = parseYifyZip(await detail.text());
|
|
640
|
+
if (!zipLink)
|
|
641
|
+
return null;
|
|
642
|
+
const zip = await fetch(`${YIFY}${zipLink}`, {
|
|
643
|
+
headers: { "User-Agent": UA, Referer: subPage },
|
|
633
644
|
signal: AbortSignal.timeout(20000)
|
|
634
645
|
});
|
|
635
646
|
if (!zip.ok)
|
|
@@ -1109,7 +1120,7 @@ class Couch {
|
|
|
1109
1120
|
touchFilm(stream.folder);
|
|
1110
1121
|
trimCache(loadConfig().cacheGB ?? 10, stream.folder);
|
|
1111
1122
|
this.room.setFilm({ id: title.id, title: title.name, year: title.year ?? undefined }, stream.urlOf(video), subs?.vtt ?? null);
|
|
1112
|
-
onStatus(`on in the room${subs ? ", English subtitles available" : ""}`);
|
|
1123
|
+
onStatus(`on in the room${subs ? ", English subtitles available" : ", no English subtitles found"}`);
|
|
1113
1124
|
}
|
|
1114
1125
|
async progress() {
|
|
1115
1126
|
return this.stream ? this.stream.progress() : null;
|
|
@@ -1956,7 +1967,7 @@ async function watch(options) {
|
|
|
1956
1967
|
}
|
|
1957
1968
|
touchFilm(stream.folder);
|
|
1958
1969
|
trimCache(options.cacheGB, stream.folder);
|
|
1959
|
-
onStatus(`playing in ${options.player}${subs ? ", English subtitles on" : ""}`);
|
|
1970
|
+
onStatus(`playing in ${options.player}${subs ? ", English subtitles on" : ", no English subtitles found"}`);
|
|
1960
1971
|
const playing = play(options.player, { url: stream.urlOf(video), title: options.name, subtitle: subs?.path ?? null, vtt: subs?.vtt ?? null });
|
|
1961
1972
|
const timer = setInterval(async () => options.onProgress(await stream.progress()), 2000);
|
|
1962
1973
|
const closed = playing.closed.then(async () => {
|
|
@@ -3686,7 +3697,7 @@ function Help() {
|
|
|
3686
3697
|
|
|
3687
3698
|
// src/cli.tsx
|
|
3688
3699
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
3689
|
-
var VERSION = "0.2.
|
|
3700
|
+
var VERSION = "0.2.1";
|
|
3690
3701
|
var HELP = `flick ${VERSION}: search a film, pick a torrent, watch it now
|
|
3691
3702
|
|
|
3692
3703
|
usage:
|
package/man/flick.1
CHANGED
package/package.json
CHANGED