manojitballav / Tutorialspoint-pdf-downloader

Download complete pdf's of Tutorial points tutorials.
Mozilla Public License 2.0
17 stars 19 forks source link

Unable to follow your process. Need help. #1

Open sfksuperman opened 3 years ago

sfksuperman commented 3 years ago

I installed Git in my pc and followed the step (cloned using your line git clone https://github.com/manojitballav/Tutorialspoint-pdf-downloader.git). Now, you said to run python pdf-generator.py but it's giving me error.

image

Sumanth-N-S commented 3 years ago

`import urllib.request import urllib, sys

def report(blocknr, blocksize, size): current = blocknrblocksize sys.stdout.write("\r{0:.2f}%".format(100.0current/size))

def downloadFile(url): fname = url.split('/')[-1] urllib.request.urlretrieve(url, fname, report) print ("Download starting...")

tld = "http://www.tutorialspoint.com/"

enter any tutorials url name from the website

in the future we could scrape and show a menu

print ("Name of Tutorial? ") query = input() url = tld+query+'/'+query+'_tutorial.pdf' downloadFile(url) print ("\nComplete PDF for " + query + " has been downloaded\n") `

use this updated code

rahulaauji-30 commented 1 year ago

Tried your updated code it also have too much errors

enoobis commented 3 weeks ago

python3

import urllib.request
import sys

def report(blocknr, blocksize, size):
    current = blocknr * blocksize
    if size > 0:
        percent = 100.0 * current / size
        sys.stdout.write("\r{0:.2f}%".format(percent))
        sys.stdout.flush()

def downloadFile(url):
    fname = url.split('/')[-1]
    print("Download starting...")
    urllib.request.urlretrieve(url, fname, report)
    print("\nDownload complete.")

tld = "http://www.tutorialspoint.com/"
print("Name of Tutorial? ")
query = input()
url = tld + query + '/' + query + '_tutorial.pdf'
downloadFile(url)
print("\nComplete PDF for " + query + " has been downloaded\n")