There are 3 supported options for you to get content of any SE site, including Stack Overflow, and store it offline:
Use the Stack Exchange quarterly datadump as found on https://archive.org/download/stackexchange (has files for all the sites around the SE network) and import the XML files in your own datastore and/or parse/filter the XML file and keep the rows you're interested in. Each xml file has multiple
<row>
elements where each<row>
will have the attributes for that entity. So for example in the Posts.xml of Stack Overflow you'll find<row>
s for each question and each answer, over 19 million in total. The Posts.xml is for that reason a 20GB file.Use the Stack Exchange Data Explorer and write a query to match your data needs and download as CSV. SEDE is refreshed once a week. You can at most fetch 50,000 records per run (Oh really?) and the query to fetch those records need to run under 2 minutes to completion.
Use the Stack Exchange API. Gives you live data, but is throttled / capped per day so if you plan on fetching lots of data, you might need a couple of days. Make sure to register your app to get a key. Apply the throttle.
For option 1 and 2 there is schema documentation found in Database schema documentation for the public data dump and SEDE
Bonus: You could setup an RSS feedreader and fetch the several RSS feeds there are: What other hidden or inobvious RSS feeds are available on Stack Exchange and its sites?. That won't backfill the posts from 2008 till now but you can start building up offline content today going forward without much effort needed.