Mythus commited on
Commit
8607f48
·
verified ·
1 Parent(s): d7b236a

Delete tantifilm.py

Browse files
Files changed (1) hide show
  1. tantifilm.py +0 -224
tantifilm.py DELETED
@@ -1,224 +0,0 @@
1
- import requests
2
- from bs4 import BeautifulSoup,SoupStrainer
3
- import re
4
- import time
5
- from info import is_movie,get_info_imdb,get_info_tmdb
6
- import config
7
- TF_FAST_SEARCH = config.TF_FAST_SEARCH
8
- TF_DOMAIN = config.TF_DOMAIN
9
-
10
-
11
- ##FOR NOW ONLY MOVIES WORK, I HOPE I CAN FIX SERIES
12
- def search(showname,ismovie,season,episode,date):
13
- url = f'https://www.tanti.bond/search/{showname}'
14
- response = requests.get(url)
15
- soup = BeautifulSoup(response.text, "lxml")
16
- if ismovie == 1:
17
- all_link = soup.select('#movies .col .list-media')
18
- for link in all_link:
19
- url = link['href']
20
- response = requests.get(url)
21
- pattern = r'Data di rilascio\s*</div>\s*<div class="text">\s*(\d{4})\s*</div>'
22
- found_date = re.search(pattern, response.text)
23
- release_date = str(found_date.group(1))
24
- print(release_date)
25
- if release_date == date:
26
- tid= url.split('-')[1]
27
- print(tid)
28
- #Return URL and even the soup so I can use it later
29
- #I try to get doodstream link inside this function so I do not have to get again the response
30
- print(url)
31
- return tid
32
- elif ismovie == 0:
33
- all_link = soup.select('#series .col .list-media')
34
- for link in all_link:
35
- base_url = link['href']
36
- url = f'{base_url}-{season}-season-{episode}-episode'
37
- response = requests.get(url)
38
- pattern = r'Data di rilascio\s*</div>\s*<div class="text">\s*(\d{4})\s*</div>'
39
- found_date = re.search(pattern, response.text)
40
- release_date = str(found_date.group(1))
41
- if release_date == date:
42
- print("RELEASE DATE IS EQUAL")
43
- tid= url.split('-')[1]
44
- print(tid)
45
- #I try to get doodstream link inside this function so I do not have to get again the response
46
- return tid
47
-
48
-
49
-
50
- def get_protect_link(id):
51
- #Get the link where the Iframe is located, which contains the doodstream url kind of.
52
- response = requests.get(f"https://p.hdplayer.casa/myadmin/play.php?id={id}")
53
- soup = BeautifulSoup(response.text, "lxml", parse_only=SoupStrainer('iframe'))
54
- print(soup)
55
- protect_link = soup.iframe['src']
56
- print("HERE PROTECT_LINK",protect_link)
57
- return protect_link
58
-
59
-
60
-
61
- def true_url(protect_link):
62
- # Define headers
63
- headers = {
64
- "Range": "bytes=0-",
65
- "Referer": "https://d000d.com/",
66
- }
67
- response = requests.get(protect_link)
68
- link = response.url
69
- #Get the ID
70
- doodstream_id = link.rsplit('/e/', 1)[-1]
71
- # Make a GET request
72
-
73
- if response.status_code == 200:
74
- # Get unique timestamp for the request
75
- real_time = str(int(time.time()))
76
-
77
- # Regular Expression Pattern for the match
78
- pattern = r"(\/pass_md5\/.*?)'.*(\?token=.*?expiry=)"
79
-
80
- # Find the match
81
- match = re.search(pattern, response.text, re.DOTALL)
82
-
83
- # If a match was found
84
- if match:
85
- # Create real link (match[0] includes all matched elements)
86
- url =f'https://d000d.com{match[1]}'
87
- rebobo = requests.get(url, headers=headers)
88
- real_url = f'{rebobo.text}123456789{match[2]}{real_time}'
89
- print(real_url)
90
- return real_url
91
- else:
92
- print("No match found in the text.")
93
- return None
94
-
95
- print("Error: Could not get the response.")
96
- return None
97
-
98
-
99
-
100
-
101
- #Get temporaly ID
102
- def tantifilm(imdb):
103
- try:
104
- general = is_movie(imdb)
105
- ismovie = general[0]
106
- imdb_id = general[1]
107
- type = "Tuttifilm"
108
- if ismovie == 0 :
109
- print("Series not supported yet")
110
- return
111
- season = int(general[2])
112
- episode = int(general[3])
113
- if "tt" in imdb:
114
- if TF_FAST_SEARCH == "0":
115
- showname,date = get_info_imdb(imdb_id,ismovie,type)
116
- elif TF_FAST_SEARCH == "1":
117
- showname = get_info_imdb(imdb_id,ismovie,type)
118
- date = None
119
- else:
120
- #else just equals them
121
- tmdba = imdb_id.replace("tmdb:","")
122
- if TF_FAST_SEARCH == "0":
123
- showname = get_info_tmdb(tmdba,ismovie,type)
124
- date = None
125
- elif ismovie == 1:
126
- season = None
127
- episode = None
128
- if "tt" in imdb:
129
- #Get showname
130
- if TF_FAST_SEARCH == "0":
131
- showname,date = get_info_imdb(imdb_id,ismovie,type)
132
-
133
- elif TF_FAST_SEARCH == "1":
134
- showname = get_info_imdb(imdb_id,ismovie,type)
135
- date = None
136
- else:
137
-
138
- #else just equals themtantifilm("tt2096673")
139
-
140
- if TF_FAST_SEARCH == "0":
141
- showname,date = get_info_tmdb(imdb,ismovie,type)
142
- date = None
143
- elif TF_FAST_SEARCH == "1":
144
- showname = get_info_tmdb(imdb,ismovie,type)
145
- date = None
146
-
147
- tid = search(showname,ismovie,season,episode,date)
148
- protect_link = get_protect_link(tid)
149
- url = true_url(protect_link)
150
- return url
151
-
152
- except Exception as e:
153
- print("Tantifilm Error")
154
-
155
-
156
-
157
-
158
-
159
-
160
-
161
-
162
-
163
-
164
-
165
-
166
- #OLD SEARC THAT DOESN't CHECK THE DATE
167
- def mamma(showname,ismovie,season,episode):
168
- url = f'https://www.tanti.bond/search/{showname}'
169
- response = requests.get(url)
170
- soup = BeautifulSoup(response.text, "lxml")
171
- if ismovie == 1:
172
- first_link = soup.select_one('#movies .col .list-media')
173
- url = first_link['href']
174
- return url
175
- elif ismovie == 0:
176
- first_link = soup.select_one('#series .col .list-media')
177
- base_url = first_link['href']
178
- url = f'{base_url}-{season}-{episode}'
179
- print(url)
180
- return url
181
-
182
-
183
-
184
-
185
-
186
-
187
-
188
-
189
-
190
-
191
-
192
-
193
-
194
-
195
-
196
-
197
- def searcht(showname,ismovie,season,episode):
198
- url = f'https://www.tanti.bond/search/{showname}'
199
- response = requests.get(url)
200
- soup = BeautifulSoup(response.text, "lxml")
201
- date = "2020"
202
- if ismovie == 1:
203
- all_link = soup.select('#movies .col .list-media')
204
- for link in all_link:
205
- url = link['href']
206
- response = requests.get(url)
207
- info_soup = BeautifulSoup(response.text, "lxml")
208
- release_date= info_soup.select('div.video-attr div.text')[4].text.strip()
209
- if release_date == date:
210
- print("WOW")
211
- #Return URL and even the soup so I can use it later
212
- return url,info_soup
213
- elif ismovie == 0:
214
- all_link = soup.select('#series .col .list-media')
215
- for link in all_link:
216
- base_url = link['href']
217
- url = f'{base_url}-{season}-season-{episode}-episode'
218
- response = requests.get(url)
219
- info_soup = BeautifulSoup(response.text, "lxml")
220
- release_date= info_soup.select('div.video-attr div.text')[4].text.strip()
221
- if release_date == date:
222
- print("RELEASE DATE IS EQUAL")
223
- #Return URL and even the soup so I can use it later
224
- return url,info_soup