Skip to content

Instantly share code, notes, and snippets.

@thehesiod
Created August 5, 2019 06:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thehesiod/b4bb29cd8934922378da539ec97adec7 to your computer and use it in GitHub Desktop.
Save thehesiod/b4bb29cd8934922378da539ec97adec7 to your computer and use it in GitHub Desktop.
Audi Manual Downloader
import requests
import shutil
def download_manual():
# three digit page number
code = 'aa99bbcc-110b-999a-9a11-bb99b9aa1d99' # example, will not work
url = "https://webcat.lex-com.net/AudiBordbuch/docs/{code}/files/assets/common/page-html5-substrates/page0{page_num:03d}_4.jpg?uni=c91d23879402ccf1e95bc4acbec392e4"
# low rez
#url = "https://webcat.lex-com.net/AudiBordbuch/docs/{code}/files/assets/common/page-html5-substrates/page0{page_num:03d}_1.jpg?uni=c91d23879402ccf1e95bc4acbec392e4"
headers = {
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'en-US,en;q=0.9,pt-BR;q=0.8,pt;q=0.7',
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36',
'Accept': 'image/webp,image/apng,image/*,*/*;q=0.8',
'Referer': f'https://webcat.lex-com.net/AudiBordbuch/docs/{code}/3/',
}
cookies = {
'_ga': 'GA1.2.685628886.1555134836',
'_gid': 'GA1.2.967178320.1555134836',
'_gat_additional0': '1'
}
session = requests.Session()
for i in range(1, 312):
print(f"Downloading: {i}")
response = session.get(url.format(page_num=i, code=code), headers=headers)
assert response.status_code == 200, f"Bad status code: {response.status_code} on page {i}"
with open(f'/tmp/audi_etron_manual_{i:03d}.jpg', 'wb') as f:
f.write(response.content)
download_manual()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment