I am building a website, which categorizes IT problems.
How can I get the content of all tags used on stackoverflow?
I need to use the same tagging feature with the same content, but separately.
How to extract the content of all tags? (should be a couple of thousand)
You can utilize the Stack Exchange Data Explorer for gathering this type of information.
The query below will pull all tags, their excerpts and their wiki content:
select
t.tagName,
e.body as 'Excerpt',
w.body as 'WikiBody'
from tags t
left join Posts e
on t.ExcerptPostId = e.Id
left join Posts w
on t.WikiPostId = w.Id
order by t.tagName
At the time of this post, this returns 42,553 rows.
Note that not all tags have excerpts or wiki content.
I developed upon @andy answer and gathered up each tag's synonyms as well
select e.id,
count(t.tagName),
string_agg(TagSynonyms.SourceTagName, ',') as synonyms,
t.tagName,
e.body as 'Excerpt',
w.body as 'WikiBody'
from tags t
left join Posts e
on t.ExcerptPostId = e.Id
left join Posts w
on t.WikiPostId = w.Id
left join TagSynonyms
on TagSynonyms.TargetTagName = t.tagName
group by t.tagName, e.body, w.body, e.id
order by count(t.tagName) desc
link is here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With