Subaru Outback Forums banner

2016 Owner's and Service Manuals Posted

69K views 42 replies 24 participants last post by  plain OM  
#1 ·
  • Like
Reactions: ldbobby
#2 ·
I said I would merge the owner's manual PDF into a single file for a 6 pack of ale.
For the low low price of more pitchers of valkyrie nectar, I can do the rest. Or you bums can just do it yourself... :grin2:

Here we go: ZippyShare Link to Manual

Code:
# Pip install required packages and import them
import lxml.html, urllib2, urlparse, os, requests, natsort
from PyPDF2 import PdfFileMerger, PdfFileReader

# File Downloader
def download_file(url, url_splitter='/'):
    local_filename = url.split(url_splitter)[-1]
    r = requests.get(url, stream=True)
    with open(local_filename, 'wb') as f:
        for chunk in r.iter_content(chunk_size=1024): 
            if chunk:
                f.write(chunk)
                f.flush()
    return local_filename

# Grab all the PDFs
def grab_files(base_url):
    res = urllib2.urlopen(base_url)
    tree = lxml.html.fromstring(res.read())
    ns = {'re': 'http://exslt.org/regular-expressions'}
    for node in tree.xpath('//a[re:test(@href, "\.pdf$", "i")]', namespaces=ns):
        pdflink = urlparse.urljoin(base_url, node.attrib['href'])
        print pdflink
        filename = download_file(pdflink)
        print("Downloading " + filename + " complete\n")
    return(0)

# Merge the PDFs
def merge_pdfs(merged_filename,files_dir=os.getcwd()):
    pdf_files = natsort.natsorted([f for f in os.listdir(files_dir) if f.endswith("pdf")])
    merger = PdfFileMerger()
    for filename in pdf_files:
        print("Merging " + filename)
        merger.append(PdfFileReader(os.path.join(files_dir, filename), "rb"))
    merger.write(os.path.join(files_dir, merged_filename))
    print("Merge Completed - " + merged_filename)
    return(merged_filename)

grab_files('http://techinfo.subaru.com/search/listResults.html?searchLit=Search&litNum=MSA5M1603A')
merge_pdfs('2016_Outback_Legacy_Manual.pdf')
 
#12 ·
I don't know anything about writing or using a script. What operating system will this work with? I'm running Win7 and realize it will need ran from the command prompt. Is the "Pip" part of the OS now or is that something that needs to be downloaded? Is there any other programs I need to download and install?

How long does it take after you pay your $35 subscription before you can start downloading?
 
#4 ·
I have PDF creation / merging software but the main reason I wrote a script is because I don't want to click and download all the links to the different sections. It'll just get all of them for me and merge it, works for all the different manuals too so it'll save me time in the long run.

It only took a few minutes to do with some existing code I had already written in the past.
 
#16 ·
...or you can buy it on CD-ROM on eBay (many Aussies sell those Down Under), download/transfer it on the memory "stick" and attach it to your key chain... that is, what I have. That way, if you are on a road trip you have it handy in remote parts of the world or garages, where they may not have access to such thing....like surfing in Nicaragua, or fishing in Barrow, AK....etc.
 
#19 ·
The procedure in the thread "2015MY Service Manual" is working. It has a detailed description on what to do, what to change, etc, and a ZIP file to download which gets you started with the correct syntax. I would read at least the first 32 posts in the thread before attempting. I made the changes mentioned in post 24 and 26 and the next time I kicked it off it started working. It took about 30 minutes to download the software, understand what to do, and kick off the script. I have downloaded the first 50 files and now it is in the wait loop for the next 50.

You have to pay your $34.95 and create a login account for this to work because you need your session ID number. Unlike the other manuals, Subaru is selling this one and it is copyrighted.
 
#22 ·
I created a couple Windows scripts to download Service Manuals (SM) from the Subaru Technical Information System (STIS) and wanted to share them with you. One is a super-minimalist version for STIS veterans whereas the other is for the rest of us. They both do the same thing, though the latter features checks to ensure proper operation along with (hopefully) useful error messages if something should go wrong.

Both are well-tested and work on Windows versions 7 to 10. They'll probably work with Vista and XP, too.

I've listed the code in-line and also attached downloadable batch scripts. Nothing is required outside the script, a copy of curl.exe, and an active STIS subscription. You will, of course, need to modify the script to set a cookie and URL which represent your login and the SM you want, respectively. These are represented by the SetMe placeholders in both scripts. The what/why/how of these is explained at the top of the second script.

Get curl.exe for free from cURL - Download . Look under 'Win32 - Generic'.

Here's the minimalist one (downloadSM_minimal.bat). This one will fail when version two of the '16 Outback manual is released, but then, you knew that ;).
Code:
@[URL="http://www.subaruoutback.org/forums/member.php?u=39621"]echo[/URL] off
setlocal enabledelayedexpansion
for /l %%x in (1, 1, 1241) do (
    curl --header "Cookie: JSESSIONID=SetMe;" "http://techinfo.subaru.com/proxy/105903/pdf/serviceManual/105903_2016_Legacy/G2520BEV1_%%x.pdf" > "G2520BEV1_%%x.pdf"
    SET /A VAR=%%x %% 50
     if !VAR! equ 0 sleep 3601
)
And here's the one for the rest of us (downloadSM.bat). As mentioned, it features useful error messages that offer help when things aren't working as well as a future-forward design.
Code:
@[URL="http://www.subaruoutback.org/forums/member.php?u=39621"]echo[/URL] off
setlocal enabledelayedexpansion

rem purpose:     Downloads a Subaru Service Manual (SM).  Subaru breaks their SMs up into 1000+ pieces and sets a limit of 50 downloads an hour. This script automates the entire download.
rem platform:    Windows
rem depends:    curl.exe needs to be in the same dir as this script.
rem author:        judoman
rem date:        23.Aug.15
rem version:        1.0

rem //////////////////////////////////////////////////////////////
rem // S E T   T H E S E   B E L O W //
rem //////////////////////////////////

set cookie=SetMe!
rem 
rem    Copy your active JSESSIONID cookie above.
rem    Get this by using your browser to log into the [URL]http://techinfo.subaru.com/[/URL] site.  Subscription required, of course.
rem    Once logged in, use this other site to learn how to get the JSESSIONID value from your browser: [URL]http://www.wikihow.com/View-Cookies[/URL]
rem    The JSESSIONID value looks like this: FCAA09AD1154D2F6AD34434173908734
rem    Do not log out of techinfo.subaru.com site with your browser until the download is done.  Doing so will invalidate your cookie.
rem 
rem    NOTE: If you see techinfo.subaru.com cookies starting with _utm<x>, ignore them.  They come from Subaru's use of Google Analytics.

set last_booklet_url=http://techinfo.subaru.com/proxy/105903/pdf/serviceManual/105903_2016_Legacy/G2520BEV1_1241.pdf
rem 
rem    The value above is the URL of the last downloadable "booklet" of the Service Manual.  Get this value by navigating to the Subaru
rem    service manual you want at [URL]http://techinfo.subaru.com/[/URL] .  For instance, here's the location of the first version of the '16 Outback/Legacy SM:
rem    [URL]http://techinfo.subaru.com/search/listResults.html?searchLit=Search&litNum=G2520BE[/URL]
rem    Scroll to the very bottom and, as mentioned, copy the URL of the last SM "booklet" into the last_booklet_url variable above.
rem    This teaches the script two things: what SM to grab, and how many booklets to grab.
rem
rem    Finally: the value above is correct as of 23.Aug.15.  However, it will break when Subaru releases revised SMs in the future.

rem \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
rem \\ D O N ' T   M E S S   W I T H   R E S T  ;) \\
rem \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

rem Strip the extension off the URL (e.g. remove .pdf from the end)
set download_url=%last_booklet_url:~0,-4%

rem Harvest the number of "booklets" we need to download.  Assuming a four digit number...
set /a maxbooklet=%download_url:~-4%

rem Finalize the base download URL by stripping off the (assumed) four digit number...
set download_url=%download_url:~0,-4%

rem Get the base filename to save locally.  We'll add the number later.
for %%A in ("%download_url%") do set filename_base=%%~nA

rem Ensure curl is present
if not exist .\curl.exe goto :no_curl


:download_SM
for /l %%x in (1, 1, %maxbooklet%) do (
    set file_to_save=./%filename_base%%%x.pdf
    curl --header "Cookie: JSESSIONID=%cookie%;" "%download_url%%%x.pdf" > !file_to_save!

    rem If the cookie is wrong or the SM URL is wrong, we'll get empty files.  Let's check...
    for %%A in (!file_to_save!) do if %%~zA equ 0 goto :abort_empty_download

    rem Modulus check.  Ergo, if we divide by 50 and there's no remainder, we sleep for an hour per Subaru's policy of 50 downloads/hr max.  Otherwise we'll get empties...
    SET /A VAR=%%x %% 50
     if !VAR! equ 0 (
         echo.
         echo ~Sleeping for one hour~
         echo.
         sleep 3601
     )
)
goto :exit


:no_curl
echo.
echo ERROR: No cURL
echo.
echo    curl.exe must be placed here: %~dp0
echo    If you don't have it, get the 'Win32 - Generic' version of curl for free from [URL]http://curl.haxx.se/download.html[/URL]

rem Of course the x64 version will work for x64 boxen
goto :exit


:abort_empty_download
echo ERROR: Empty file downloaded
echo    Check if the cookie is correctly set and retry. If it still doesn't work, ensure the last_booklet_url is correct.
goto :exit

:exit
endlocal
Enjoy!
 

Attachments

#30 ·
Judoman - trying out the script and it seems to work for me except it doesn't seem to sleep after 50. I gets to the limit from Subaru and the download files keep incrementing and failing all the way to the last file (I rem'ed out the echo so I could see the results). Not sure if I am doing something wrong with it. If I can't get that to resolve, could you point me to how to change the variable to change to my next starting point for the cycle? i.e. I have the first 50 downloaded and want to start with 51. Do I change the ~0 in this: set download_url=%download_url:~0,-4% to ~51?

I'd love to figure out what I am doing wrong with the sleep loop, however if possible. I am on Win 10 and running the 64 bit version of curl.
 
#31 ·
I am unfortunately not computer program savvy enough to understand these scripts (I am an epidemiologist and am used to dealing with public health related topics). If I were to pay for the subscription and throw in a 12 pack of any good beer, would someone be willing to assist me with downloading the maintenance and factory service manuals? I live in the Atlanta area.

Thanks
 
#35 ·
Thanks, judoman! I used your windows script and it worked great.

One small thing that i ran into that others might have to deal with: Upon first run, I got an error because the sleep command wasn't available on my system. Apparently it's part of a package that I didn't have installed on my Surface Pro 4. A little googling led me to a replacement standalone utility. Grabbed that, small tweak to the .bat file, fired it up again and Bob's your uncle.

I used Acrobat Pro to combine the downloaded PDF files. I discovered that Acrobat Pro has a limit of 750 files so I combined half, then the other half, then combined the two halves.

Thanks again!
 
#38 ·