Hashir Kashif commited on
Commit
6894fb4
·
1 Parent(s): 3b93031

Add applicatiosdfsdfn file

Browse files
Files changed (1) hide show
  1. app.py +4 -50
app.py CHANGED
@@ -214,64 +214,18 @@ def getNetflixInfoWithApi(cookiefile):
214
  # print(cookies)
215
  if cookies != "fail":
216
 
217
- r = requests.get("https://www.netflix.com/BillingActivity",
218
  cookies=cookies)
219
  print(r.url)
220
  if "login" in r.url:
221
  print("Login Page")
222
- os.remove(cookiefile)
223
  thr = Thread(target=removeCookieFromServer,args=(cookiefile,))
224
  thr.start()
225
  return "Not working"
226
- else:
227
  soup = BeautifulSoup(r.content, "html.parser")
228
- try:
229
- print(r.url)
230
- billingDate = soup.find("div", {
231
- "data-uia": "streaming-next-cycle"
232
- })
233
- NetflixLocation = soup.find("div", {
234
- "data-uia": "loc"
235
- })['lang']
236
- print(NetflixLocation)
237
- print(billingDate)
238
- try:
239
- billingDate = billingDate.get_text()
240
- except:
241
- billingDate = " "
242
- planName = soup.find("div", {"data-uia": "plan-name"})
243
- print(planName)
244
-
245
- planName = planName.get_text()
246
-
247
- billingDate = GoogleTranslator(source='auto',
248
- target='en').translate(billingDate)
249
- try:
250
- lang = soup.find("html", {"lang": 'en'}).get_text()
251
- lang = "English"
252
- except:
253
- lang = ""
254
- pass
255
- planName = GoogleTranslator(source='auto',
256
- target='en').translate(planName)
257
-
258
- print(billingDate + " " + planName + " " + lang + " " +str(NetflixLocation))
259
-
260
- os.remove(cookiefile)
261
- return "Working"
262
-
263
- except Exception as e:
264
- print(e)
265
- f = open("./Membership/error.txt", "a")
266
- f.write(str(e) + "\n\n")
267
- f.close()
268
- os.remove(cookiefile)
269
- thr = Thread(target=removeCookieFromServer,args=(cookiefile,))
270
- thr.start()
271
- return "Error occured"
272
  else:
273
- os.remove(cookiefile)
274
- print("cookie removed")
275
  thr = Thread(target=removeCookieFromServer,args=(cookiefile,))
276
  thr.start()
277
  return "invalid cookie"
@@ -321,7 +275,7 @@ def sftp_connect():
321
  ftp = ssh_client.open_sftp()
322
  return ftp,ssh_client
323
  def removeCookieFromServer(cookiefile):
324
-
325
  ftp,ssh_client = sftp_connect()
326
  ftp.remove("./domains/hashir672.serv00.net/public_html/Membership/"+cookiefile)
327
  ssh_client.close()
 
214
  # print(cookies)
215
  if cookies != "fail":
216
 
217
+ r = requests.get("https://www.netflix.com/browse",
218
  cookies=cookies)
219
  print(r.url)
220
  if "login" in r.url:
221
  print("Login Page")
 
222
  thr = Thread(target=removeCookieFromServer,args=(cookiefile,))
223
  thr.start()
224
  return "Not working"
225
+ elif "browse" in r.url:
226
  soup = BeautifulSoup(r.content, "html.parser")
227
+ return "working"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
228
  else:
 
 
229
  thr = Thread(target=removeCookieFromServer,args=(cookiefile,))
230
  thr.start()
231
  return "invalid cookie"
 
275
  ftp = ssh_client.open_sftp()
276
  return ftp,ssh_client
277
  def removeCookieFromServer(cookiefile):
278
+ os.remove(cookiefile)
279
  ftp,ssh_client = sftp_connect()
280
  ftp.remove("./domains/hashir672.serv00.net/public_html/Membership/"+cookiefile)
281
  ssh_client.close()