i trying make subtitle downloader takes name of files in folder , searches on website 'subscene.com'. able scrap html source using beautiful soup unable link zip file html source. downloading gets triggered clicking on 'download button'.
there no such explicit link zip file download. there anyway solve problem?
you don't want explicit link download zip file
here logic used python downloader script
myfile2= urllib2.urlopen( url ) # input link myhtml2 = myfile2.read() soup2 = beautifulsoup(myhtml2,"lxml") downloaddiv= soup2.find("div", {"class": "download"}) #finding div class link downloadlink = downloaddiv.find('a') #finding url div class download = 'https://subscene.com/'+downloadlink['href'] #appending above url main domain genrating download r = requests.get(download) # request downloading z = zipfile.zipfile(io.bytesio(r.content)) # opening zip file z.extractall() # extracting zip file
you need these headerfiles
import zipfile bs4 import beautifulsoup import urllib2 import lxml.html stringio import stringio zipfile import zipfile urllib import urlopen import requests ,io
hope understand correct!!
Comments
Post a Comment