-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathxtractor.py
74 lines (56 loc) · 2.32 KB
/
xtractor.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import msvcrt as m
import requests
import time
import re
banner = r'''
____ ___ __ __
\ \/ // |_____________ _____/ |_ ___________
\ /\ __\_ __ \__ \ _/ ___\ __\/ _ \_ __ \
/ \ | | | | \// __ \\ \___| | ( <_> ) | \/
/___/\ \|__| |__| (____ /\___ >__| \____/|__|
\_/ \/ \/
[@Sameera Madushan]
'''
print(banner)
url = input("Enter the URL of tv series: ")
x = re.match(r'^(https:|)[/][/]www.([^/]+[.])*todaytvseries6.com', url)
try:
if x:
req = requests.get(url).content.decode('utf-8')
seasons = re.findall(r'Download Season ([0-9]{1,})', req)
seasons.sort()
get_title = re.search(r'uk-article-title uk-badge1">(.*)</h1>', req).group(1)
print("\nAvailable seasons to download in" + get_title)
for i in seasons:
print(get_title + "season"+ " " + i)
user_input1 = input("\nEnter the season number that you want to download: ").zfill(2)
if user_input1 == str("1") or str("01"):
g = str(int(user_input1))
else:
g = str(int(user_input1) - 1)
if g in seasons:
a = re.findall(r'<div class="cell2">(S'+user_input1+'E[0-9]{1,})', req)
print("\nAvailable episodes in " + user_input1 + "\n")
print(a)
links = []
for i in a:
if i in req:
t = re.findall(r''+i+'</div><div class="cell[0-9]">[0-9]{1,} Mb</div><div class="cell[0-9]"><a href=[\'"]?([^\'" >]+)" class="hvr-icon-sink-away" target="_blank">.*</a></div>', req)[0]
links.append(t)
else:
print("Unknown Error")
link_file = open("links.txt", "w")
for i in links:
link_file.write(i + "\n")
link_file.close()
print("\nDownload links saved to \"links.txt\" successfully")
else:
print("Season " + user_input1 + " not available")
else:
print("\nURL not related with todaytvseries2.com domain.")
except KeyboardInterrupt:
print('\nProgramme Interrupted')
print("\nPress any key to exit")
m.getch()
print("Exiting...")
time.sleep(1)