Skip to content

Commit 9286711

Browse files
committed
.
1 parent a86b9a8 commit 9286711

File tree

2 files changed

+46
-32
lines changed

2 files changed

+46
-32
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
- Hopeful fix for `Amount saved` not showing
77
- Hopeful fix for Manual login
88
- Fixed not saving courses to file on unexpected exit.
9-
- Simplified some logic (Duce's and mine also)
9+
- Simplified some logic (DUCE's and mine also)
1010

1111
## v1.3
1212
- Added Save to txt file option in CLI and GUI

CLI/duce.py

Lines changed: 45 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,25 @@ def idcoupons():
188188
idc_bar.close()
189189

190190

191+
def enext() -> list:
192+
en_links = []
193+
r = requests.get("https://e-next.in/e/udemycoupons.php")
194+
soup = bs(r.content, "html.parser")
195+
big_all = soup.find_all("p", {"class": "p2"})
196+
big_all.pop(0)
197+
en_bar = tqdm(total=len(big_all), desc="E-next")
198+
for i in big_all:
199+
en_bar.update(1)
200+
title = i.text.strip().removesuffix("Enroll Now free").strip()
201+
link = i.a["href"]
202+
en_links.append(title + "|:|" + link)
203+
204+
en_bar.close()
205+
206+
191207
# Constants
192208

193-
version = "v1.3"
209+
version = "v1.4"
194210

195211

196212
def create_scrape_obj():
@@ -201,6 +217,7 @@ def create_scrape_obj():
201217
"Real Discount": threading.Thread(target=real_discount, daemon=True),
202218
"Course Vania": threading.Thread(target=coursevania, daemon=True),
203219
"IDownloadCoupons": threading.Thread(target=idcoupons, daemon=True),
220+
"E-next": threading.Thread(target=enext, daemon=True),
204221
}
205222
return funcs
206223

@@ -238,7 +255,9 @@ def load_settings():
238255
settings["languages"]["Russian"]
239256
except KeyError:
240257
settings["languages"]["Russian"] = True
241-
settings.setdefault("save_txt", True) #v1.3
258+
settings.setdefault("save_txt", True) # v1.3
259+
settings["sites"].setdefault("E-next", True) # v1.4
260+
settings.setdefault("discounted_only", False) # v1.4
242261
return settings, instructor_exclude, title_exclude
243262

244263

@@ -334,12 +353,12 @@ def check_login(email, password):
334353
data = {
335354
"email": email,
336355
"password": password,
356+
"locale": "en_US",
337357
"csrfmiddlewaretoken": csrf_token,
338358
}
339359
s.headers.update(
340360
{
341361
"Referer": "https://www.udemy.com/join/login-popup/?locale=en_US",
342-
"user-agent": "APIs-Google (+https://developers.google.com/webmasters/APIs-Google.html)",
343362
}
344363
)
345364
r = s.post(
@@ -437,7 +456,7 @@ def auto(list_st):
437456
if settings["save_txt"]:
438457
if not os.path.exists("Courses/"):
439458
os.makedirs("Courses/")
440-
txt_file = open(f"Courses/"+time.strftime("%Y-%m-%d--%H-%M"),"w")
459+
txt_file = open(f"Courses/" + time.strftime("%Y-%m-%d--%H-%M"), "w")
441460
for index, combo in enumerate(list_st):
442461

443462
tl = combo.split("|:|")
@@ -483,8 +502,11 @@ def auto(list_st):
483502
print(fg + "Successfully Enrolled\n")
484503
se_c += 1
485504
as_c += amount
486-
if settings["save_txt"]: txt_file.write(combo + "\n")
487-
505+
if settings["save_txt"]:
506+
txt_file.write(combo + "\n")
507+
txt_file.flush()
508+
os.fsync(txt_file.fileno())
509+
488510
elif js["status"] == "failed":
489511
# print(js)
490512
print(fr + "Coupon Expired\n")
@@ -520,7 +542,10 @@ def auto(list_st):
520542
print(fg + "Successfully Subscribed\n")
521543
se_c += 1
522544
as_c += amount
523-
if settings["save_txt"]: txt_file.write(combo + "\n")
545+
if settings["save_txt"]:
546+
txt_file.write(combo + "\n")
547+
txt_file.flush()
548+
os.fsync(txt_file.fileno())
524549
except:
525550
print(fr + "COUPON MIGHT HAVE EXPIRED\n")
526551
e_c += 1
@@ -560,30 +585,19 @@ def main1():
560585
funcs[t].join()
561586
time.sleep(1)
562587

563-
try: # du_links
564-
links_ls += du_links
565-
except:
566-
pass
567-
try: # uf_links
568-
links_ls += uf_links
569-
except:
570-
pass
571-
try: # tb_links
572-
links_ls += tb_links
573-
except:
574-
pass
575-
try: # rd_links
576-
links_ls += rd_links
577-
except:
578-
pass
579-
try: # cv_links
580-
links_ls += cv_links
581-
except:
582-
pass
583-
try: # idc_links
584-
links_ls += idc_links
585-
except:
586-
pass
588+
for link_list in [
589+
"du_links",
590+
"uf_links",
591+
"tb_links",
592+
"rd_links",
593+
"cv_links",
594+
"idc_links",
595+
"en_links",
596+
]:
597+
try:
598+
links_ls += eval(link_list)
599+
except:
600+
pass
587601

588602
auto(links_ls)
589603

0 commit comments

Comments
 (0)