Skip to content

Instantly share code, notes, and snippets.

@StevenACoffman
Created October 3, 2021 00:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save StevenACoffman/14487c47b7b15c8889ae1c8f12a25d43 to your computer and use it in GitHub Desktop.
Save StevenACoffman/14487c47b7b15c8889ae1c8f12a25d43 to your computer and use it in GitHub Desktop.
Get Source code from Stack overflow
1. If you have a particular StackOverflow question such as:
2. When you click on the little recylcing symbol next to a question or answer "Show activity on this post", you will get to the timeline:

https://stackoverflow.com/posts/69419917/timeline#history_9281a690-64c3-4302-bb36-1ebb6dfd3ecf

3. Take the post ID that is exposed in the timeline url as above

Go to Question revision history:

https://sitename.stackexchange.com/posts/{post-id}/revisions

  • shown as the “history” link for questions and answers with at least two revisions
  • contains links to individual revisions and their source code, as well as summaries of a number of other events such as closing, reopening, (un)deleting, bounty start/end, (un)locking, tweeting, marked (not) community wiki, and merging.
4. So then you will have a URL like this:

https://stackoverflow.com/posts/69419917/revisions

5. And then the source code looks like this:

https://stackoverflow.com/revisions/9281a690-64c3-4302-bb36-1ebb6dfd3ecf/view-source

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment