-
Notifications
You must be signed in to change notification settings - Fork 0
/
Streamline.py
60 lines (49 loc) · 2.65 KB
/
Streamline.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import requests
import pyperclip
from bs4 import BeautifulSoup
import webbrowser
import subprocess
title_art = r"""
________ _________ ________ _______ ________ _____ ______ ___ ___ ________ _______
|\ ____\ |\___ ___\|\ __ \ |\ ___ \ |\ __ \ |\ _ \ _ \ |\ \ |\ \ |\ ___ \ |\ ___ \
\ \ \___|_\|___ \ \_|\ \ \|\ \\ \ __/| \ \ \|\ \\ \ \\\__\ \ \\ \ \ \ \ \\ \ \\ \ \\ \ __/|
\ \_____ \ \ \ \ \ \ _ _\\ \ \_|/__\ \ __ \\ \ \\|__| \ \\ \ \ \ \ \\ \ \\ \ \\ \ \_|/__
\|____|\ \ \ \ \ \ \ \\ \|\ \ \_|\ \\ \ \ \ \\ \ \ \ \ \\ \ \____ \ \ \\ \ \\ \ \\ \ \_|\ \
____\_\ \ \ \__\ \ \__\\ _\ \ \_______\\ \__\ \__\\ \__\ \ \__\\ \_______\\ \__\\ \__\\ \__\\ \_______\
|\_________\ \|__| \|__|\|__| \|_______| \|__|\|__| \|__| \|__| \|_______| \|__| \|__| \|__| \|_______|
\|_________|
"""
print(title_art+'\n')
def download_and_stream(search_name, stream=False):
# Construct the search URL
search_url = f"https://thepiratebay10.org/search/{search_name}/1/99/0"
# Send a GET request to the search URL
response = requests.get(search_url)
# Parse the HTML content of the search page
soup = BeautifulSoup(response.content, 'html.parser')
# Find the search results
search_results = soup.select('div#main-content')
if search_results:
for result in search_results:
magnet_link = result.select_one('a[href^=magnet]')
if magnet_link:
magnet_link = magnet_link['href']
if stream:
cmd = ['peerflix', magnet_link, '--vlc', '--fullscreen']
subprocess.call(cmd, shell=True)
print("Torrent downloaded and streamed successfully.")
else:
# Download the torrent
webbrowser.open(magnet_link)
print("Torrent software opened, Download finished.")
break
else:
print("No magnet link found in the search results.")
else:
print("No search results found.")
# Ask the user to input a name
search_name = input("Enter a name to search for: ")
# Ask the user if they want to stream the torrent
stream = input("Do you want to stream the torrent? (yes/no): ")
# Download and stream the torrent
download_and_stream(search_name, stream.lower() == 'yes')