karlicoss / stexport

Export and access your Stackexchange data
MIT License
11 stars 1 forks source link

Added --user-sites flag #3

Closed Cobertos closed 3 years ago

Cobertos commented 3 years ago

No tests, haven't run through mypy, but tested on my machine and --site=stackoverflow, --all-sites and --user-sites all work.

Note, --user-sites will require an access_token, as it needs to access /me/associated-users, otherwise you get a 401 error.

Also /me/associated-users doesn't return site API stems (like /sites does), so it has to do a little bit of fuckery to match the site_name field to the name field, also removing Stack Exchange suffix. The only mapping in my accounts that didn't map was Meta Stack Exchange, otherwise I was able to get quite a few

image

Cobertos commented 3 years ago

Mypy types should be fixed

ankostis commented 3 years ago

If i get it right, what's the use of keeping --all, and not replace it with --user-sites?

Cobertos commented 3 years ago

Not much that I can see. Only debugging and backward-compatibility I can imagine. It's easy to support though just because it's just a slightly different input to sites=

karlicoss commented 3 years ago

Thanks @Cobertos ! @ankostis another usecase for --all-sites is that it doesn't require oauth access_token, apparently you can just register the app, get the key and keep access_token empty! Although not sure which implications it has for which data is included in the export (presumably it will only have access to 'public' data)