-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathfg_movies
205 lines (167 loc) · 4.73 KB
/
fg_movies
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
#!/usr/bin/python
# -*- coding:utf-8 -*-
import os
import sys
import warnings
import tqdm
import libtorrent as lt
import time
import datetime
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
warnings.filterwarnings("ignore")
urls = []
picture = []
tamilmv = []
tamilmv_urls = []
def site_pirate_bay():
options = webdriver.ChromeOptions()
options.add_argument('--headless=chrome')
options.add_extension('/usr/bin/ad.zip')
options.add_experimental_option("detach", True)
options.add_argument('--allow-running-insecure-content')
driver = webdriver.Chrome(executable_path='/usr/bin/chromedriver', options=options)
driver.get('https://pbays.top/')
time.sleep(5)
driver.find_element("xpath", '//*[@id="all"]').click()
driver.find_element("xpath", '//*[@id="video"]').click()
s1 = driver.find_element("xpath", '//*[@id="inp"]/input')
s1.send_keys(ask)
s1.send_keys(Keys.ENTER)
time.sleep(1)
titles = driver.find_elements('xpath', '//div[contains(@class, "detName")] //a')
for movies in titles:
picture.append(movies.text)
urls.append(movies.get_attribute('href'))
time.sleep(10)
driver.quit()
def download():
ses = lt.session()
ses.listen_on(6881, 6891)
params = {
'save_path': dir,
'storage_mode': lt.storage_mode_t(2)
}
handle = lt.add_magnet_uri(ses, link, params)
ses.start_dht()
print("\nDownloading...",handle.name())
while not handle.has_metadata():
time.sleep(1)
total_size = handle.status().total_wanted
pbar = tqdm.tqdm(total=total_size, unit="B", unit_scale=True, unit_divisor=1024)
while handle.status().state != lt.torrent_status.seeding:
s = handle.status()
pbar.update(s.total_download - pbar.n)
time.sleep(1)
pbar.close()
print("\nDownload complete!")
def down():
global link
if picked == '0':
r = 0
elif picked == '1':
r = 1
elif picked == '2':
r = 2
elif picked == '3':
r = 3
elif picked == '4':
r = 4
elif picked == '5':
r = 5
elif picked == '6':
r = 6
elif picked == '7':
r = 7
elif picked == '8':
r = 8
elif picked == '9':
r = 9
elif picked == '10':
r = 10
elif picked == '11':
r = 11
elif picked == '12':
r = 12
elif picked == '13':
r = 13
elif picked == '14':
r = 14
elif picked == '15':
r = 15
elif picked == '16':
r = 16
elif picked == '17':
r = 17
elif picked == '18':
r = 18
elif picked == '19':
r = 19
elif picked == '20':
r = 20
elif picked == '21':
r = 21
elif picked == '22':
r = 22
elif picked == '23':
r = 23
elif picked == '24':
r = 24
elif picked == '25':
r = 25
elif picked == '26':
r = 26
elif picked == '27':
r = 27
elif picked == '28':
r = 28
elif picked == '29':
r = 29
else:
print('invalid input \nexiting!')
sys.exit(0)
print('\nplease be patient your download will begin in few seconds')
options = webdriver.ChromeOptions()
options.add_argument('--headless=chrome')
options.add_extension('/usr/bin/ad.zip')
options.add_argument("--disable-gpu")
options.add_experimental_option("detach", True)
options.add_argument('--allow-running-insecure-content')
driver = webdriver.Chrome(executable_path='/usr/bin/chromedriver', options=options)
driver.get(urls[r])
link = driver.find_element('xpath', '//*[@id="details"]/div[3]/div[1]/a[1]').get_attribute('href')
driver.quit()
download()
def start():
global ask, dir, picture, picked
os.system('clear')
ask = input('\nEnter the movie name: ')
dir = input('\nwhere would u like to store the movie(/path/to/download): ')
site_pirate_bay()
if not picture:
print('the movie does not exist or not found')
sys.exit(0)
for number, movie in enumerate(picture):
print("\n", number, movie)
picked = input('\nFG_Teams: ')
down()
def ask():
global which_to_use
os.system('clear')
print('Hello guys too many movies movies will not be available on all sites')
print('\n1. piratebay (default)')
print('other options coming soon')
which_to_use = input('\n\n\nFG_Teams: ')
if __name__ == '__main__':
try:
ask()
if which_to_use == '1':
start()
elif which_to_use == '':
start()
else:
print('invalid argument exiting!')
sys.exit(0)
except KeyboardInterrupt:
print('\nExit signal received \nexiting ')
sys.exit(0)