Grab 100%off udemy coupons & enroll automatically

All new tutorial are submitted here.
They will be moved to the main Tutorials section once they have been approved by mods and admins.

Grab 100%off udemy coupons & enroll automatically

Postby bhishan » Fri May 08, 2015 3:05 am

Python codes to extract 100%off coupon codes from growthcoupon.com and enroll in those courses automatically. The code enrolls in 10 latest 100%off courses at udemy at a time. Here's a link to the article. http://www.thetaranights.com/enroll-in-100-off-courses-at-udemy-automatically-python-codes-to-get-free-courses/
bhishan
 
Posts: 22
Joined: Sun May 18, 2014 7:57 am
Location: Kathmandu, Nepal

Re: Grab 100%off udemy coupons & enroll automatically

Postby Kebap » Fri May 08, 2015 9:43 am

Hi bhishan, thanks for linking to your article.

Nice code there to automate the grabbing & using of these 100% udemy coupons. Here it is for all who don't follow links:

Code: Select all
from json import loads
from bs4 import BeautifulSoup
import mechanize
api_key = "8def4868-509c-4f34-8667-f28684483810%3AS7obmNY1SsOfHLhP%2Fft6Z%2Fwc46x8B2W3BaHpa5aK2vJwy8VSTHvaPVuUpSLimHkn%2BLqSjT6NERzxqdvQ%2BpQfYA%3D%3D" growth_coupon_url = "https://api.import.io/store/data/a5ef05a9-784e-410c-9f84-51e1e8ff413c/_query?input/webpage/url=http%3A%2F%2Fgrowthcoupon.com%2Fcoupon-category%2F100-discount%2F&_user=8def4868-509c-4f34-8667-f28684483810&_apikey=" + api_key
br = mechanize.Browser()
br.set_handle_robots(False)
br.addheaders = [("User-agent","Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101206 Ubuntu/10.10 (maverick) Firefox/3.6.13")]
sign_in = br.open("https://www.udemy.com/join/login-popup/")
br.select_form(nr=3)
br["email"] = "email@domain.com"
br["password"] = "password"
logged_in = br.submit()

growth_coupon = br.open(growth_coupon_url)
json_obj = loads(growth_coupon.read())

for course_link in json_obj["results"]:
    course_page = br.open(course_link["couponcode_link"])
    soup = BeautifulSoup(course_page)
    for link in soup.find_all("a"):
         req_link = link.get('href')
         if 'https://www.udemy.com/payment/checkout' in str(req_link):
              print req_link
              br.open(str(req_link))
              print "success"
              break

Additional explanations are available when you do follow the link in the original post of this thread. ;)

bhishan, maybe you want to remove your api_key though? Not sure if it is supposed to be a secret.

Also not sure if this can count as a tutorial or not.
Due to the reasons discussed here we are moving to python-forum.net on October 1, 2016.

This forum will be closed. Please create an account at the new site to continue discussion.

IRC://irc.freenode.net/python-forum
Kebap
 
Posts: 689
Joined: Thu Apr 04, 2013 1:17 pm
Location: Germany, Europe

Re: Grab 100%off udemy coupons & enroll automatically

Postby Mekire » Fri May 08, 2015 9:46 am

I personally think this kind of thing is more along the lines of "completed scripts"; or possibly could be added to the list of python resource links.
New Users, Read This
  • Use code tags when posting code.
  • Include any errors with your post (in code tags).
  • Describe your problem; not your chosen solution.
  • Make examples the minimum length to demonstrate your issue.
User avatar
Mekire
 
Posts: 1711
Joined: Thu Feb 07, 2013 11:33 pm
Location: Tucson, Arizona

Re: Grab 100%off udemy coupons & enroll automatically

Postby Kebap » Fri May 08, 2015 11:05 am

Mekire wrote:completed scripts

Sounds about right.
Due to the reasons discussed here we are moving to python-forum.net on October 1, 2016.

This forum will be closed. Please create an account at the new site to continue discussion.

IRC://irc.freenode.net/python-forum
Kebap
 
Posts: 689
Joined: Thu Apr 04, 2013 1:17 pm
Location: Germany, Europe

Re: Grab 100%off udemy coupons & enroll automatically

Postby bhishan » Sat May 09, 2015 1:40 pm

Thank You All :)
bhishan
 
Posts: 22
Joined: Sun May 18, 2014 7:57 am
Location: Kathmandu, Nepal


Return to Tutorial Submissions

Who is online

Users browsing this forum: No registered users and 2 guests