-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c2d25dc
Showing
2 changed files
with
105 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<h1 align="center">NOTFLIX</h1> | ||
<p align="center">fk netflix use notflix a tool which search magnet links and stream it with [webtorrent](https://webtorrent.io/)</p> | ||
|
||
## | ||
|
||
<img src="http://0x0.st/os4a.gif" alt="Video Preview Gif" align="right" width="500px"/> | ||
|
||
### How does this work? | ||
|
||
This is a shell script. It scape 1337x and get the magnet link. | ||
After this it use [webtorrent](https://webtorrent.io/) to stream the video from magnet link. | ||
For scraping script use simple gnu utils like sed, awk, paste, cut. | ||
|
||
## Requirements | ||
|
||
* [webtorrent](https://webtorrent.io/) - A tool to stream torrent. =sudo npm install webtorrent -g= | ||
|
||
## Installation | ||
|
||
### cURL | ||
cURL **tuxi** to your **$PATH** and give execute permissions. | ||
|
||
```sh | ||
$ sudo curl -sL "https://raw.githubusercontent.com/Bugswriter/notflix/master/notflix" -o /usr/local/bin/notflix | ||
$ sudo chmod +x /usr/local/bin/notflix | ||
``` | ||
> To update, just do `curl` again, no need to `chmod` anymore. | ||
> To uninstall, simply remove `tuxi` from your **$PATH**, for example `sudo rm -f /usr/local/bin/notflix`. | ||
## License | ||
|
||
This project is licensed under [GPL-3.0](./LICENSE). | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#!/bin/sh | ||
|
||
# Dependencies - webtorrent, mpv | ||
|
||
mkdir -p $HOME/.cache/notflix | ||
|
||
menu="fzf" | ||
menu="dmenu -i -l 25" | ||
baseurl="https://1337x.wtf" | ||
cachedir="$HOME/.cache/notflix" | ||
|
||
if [ -z $1 ]; then | ||
query=$(dmenu -p "Search Torrent: " <&-) | ||
else | ||
query=$1 | ||
fi | ||
|
||
query="$(sed 's/ /+/g' <<<$query)" | ||
|
||
#curl -s https://1337x.to/category-search/$query/Movies/1/ > $cachedir/tmp.html | ||
curl -s $baseurl/search/$query/1/ > $cachedir/tmp.html | ||
|
||
# Get Titles | ||
grep -o '<a href="/torrent/.*</a>' $cachedir/tmp.html | | ||
sed 's/<[^>]*>//g' > $cachedir/titles.bw | ||
|
||
result_count=$(wc -l $cachedir/titles.bw | awk '{print $1}') | ||
if [ "$result_count" -lt 1 ]; then | ||
notify-send "😔 No Result found. Try again 🔴" | ||
exit 0 | ||
fi | ||
|
||
# Seeders and Leechers | ||
grep -o '<td class="coll-2 seeds.*</td>\|<td class="coll-3 leeches.*</td>' $cachedir/tmp.html | | ||
sed 's/<[^>]*>//g' | sed 'N;s/\n/ /' > $cachedir/seedleech.bw | ||
|
||
# Size | ||
grep -o '<td class="coll-4 size.*</td>' $cachedir/tmp.html | | ||
sed 's/<span class="seeds">.*<\/span>//g' | | ||
sed -e 's/<[^>]*>//g' > $cachedir/size.bw | ||
|
||
# Links | ||
grep -E '/torrent/' $cachedir/tmp.html | | ||
sed -E 's#.*(/torrent/.*)/">.*/#\1#' | | ||
sed 's/td>//g' > $cachedir/links.bw | ||
|
||
# Clearning up some data to display | ||
sed 's/\./ /g; s/\-/ /g' $cachedir/titles.bw | | ||
sed 's/[^A-Za-z0-9 ]//g' | tr -s " " > $cachedir/tmp && mv $cachedir/tmp $cachedir/titles.bw | ||
|
||
awk '{print NR " - ["$0"]"}' $cachedir/size.bw > $cachedir/tmp && mv $cachedir/tmp $cachedir/size.bw | ||
awk '{print "[S:"$1 ", L:"$2"]" }' $cachedir/seedleech.bw > $cachedir/tmp && mv $cachedir/tmp $cachedir/seedleech.bw | ||
|
||
# Getting the line number | ||
LINE=$(paste -d\ $cachedir/size.bw $cachedir/seedleech.bw $cachedir/titles.bw | | ||
$menu | | ||
cut -d\- -f1 | | ||
awk '{$1=$1; print}') | ||
|
||
|
||
notify-send "🔍 Searching Magnet seeds 🧲" | ||
url=$(head -n $LINE $cachedir/links.bw | tail -n +$LINE) | ||
fullURL="${baseurl}${url}/" | ||
|
||
# Requesting page for magnet link | ||
curl -s $fullURL > $cachedir/tmp.html | ||
magnet=$(grep -Po "magnet:\?xt=urn:btih:[a-zA-Z0-9]*" $cachedir/tmp.html | head -n 1) | ||
|
||
webtorrent "$magnet" --mpv | ||
|
||
# Simple notification | ||
notify-send "🎥 Enjoy Watching ☺️ " |