Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- #Script By 8ThBiT.net ~
- import requests
- import re
- import os
- import sys
- from bs4 import BeautifulSoup
- def getUrl(u):
- r = requests.session()
- return r.get(u).text
- if len(sys.argv) == 1:
- print "[!] Usage {0} https://laracasts.com/series/laravel-from-scratch-2017".format(sys.argv[0])
- exit(-1)
- url = sys.argv[1]
- if(url[len(url) -1 ] != '/'):
- url = url + "/"
- print "[+] Getting Course Episodes"
- CoursePage = getUrl(url)
- match = re.findall('<strong>(\d+)<\/strong>',CoursePage,flags=re.MULTILINE)
- if(len(match) != 1):
- print "Invalid Response"
- exit(-1)
- cl = int(match[0])
- cl = cl + 1
- for i in range(1,cl):
- episode = "{0}episodes/{1}".format(url, i)
- print "[+] Sending Request to {0}".format(episode)
- episodePage = getUrl(episode)
- soup = BeautifulSoup(episodePage,'html.parser')
- title = soup.select('meta[property="og:title"]')[0]["content"]
- sources = soup.findAll('source')
- if len(sources) > 1:
- for source in sources:
- if(source['data-quality'] == 'HD'):
- print "[+] Downloading {0} - {1}".format((str(i).zfill(3)),title)
- os.system('wget -O "{0} - {1}.{2}" {3}'.format((str(i).zfill(3)),title,"mp4",'https:' + source["src"]))
- elif len(sources) == 1:
- print "[+] Downloading {0}".format(title)
- os.system('wget -O "{0} - {1}.{2}" {3}'.format((str(i).zfill(3)), title, "mp4", 'https:' + sources["src"]))
- else:
- print "[-] No Video Source For Episode {0}".format(i)
Add Comment
Please, Sign In to add comment