Hitu
Hitu

Reputation: 286

Allow Wget to download only application type of PDF

I am using wget on Window machine. i want only pdf file. if application/type is pdf . allow only to download

I am using this command

wget  --accept pdf www.google.com

it is downloading index page of google.

Length: 19404 (19K) [text/html] Saving to: `index.html@gfe_rd=cr&ei=5O8jVLycNuvA8gftoYGIBg'

i dont want to allow . if there is only pdf.

Any idea

Thanks

Upvotes: 1

Views: 1432

Answers (1)

dee
dee

Reputation: 557

Normally this would be

wget --header='Accept: application/pdf' www.google.com

but google.com seems to ignore the Accept: header, so you may want to

wget --debug --header='Accept: application/pdf' www.google.com 2>&1 | grep 'Content-Type: application/pdf'

and test the result of that command.

Upvotes: 2

Related Questions