Code golf scraper

0

Please login or register to vote for this query.

(click on this box to dismiss)

How to use it: 1. Run with default maxID 2. Download the CSV 3. Scroll to the bottom and copy the bottommost leftmost number (smallest answer ID returned) into maxID 4. Run again 5. Repeat 2-4 until you get less than 50000 results, and merge all CSV files downloaded

Stack Overflow

Q&A for professional and enthusiast programmers

with CodeGolfQs as (
    select distinct Q.Id
    from Posts Q
    where Q.PostTypeId = 1
        and Q.CommunityOwnedDate is null
        and Q.DeletionDate is null
        and Q.ClosedDate is null
        and Q.Tags like '%<code-golf>%'
        and Q.Tags not like '%<tips>%'
        and Q.Tags not like '%<cops-and-robbers>%'
        and Q.Tags not like '%<polyglot>%'
        and Q.Tags not like '%<code-challenge>%'
        and Q.Tags not like '%<popularity-contest>%'
        and Q.Tags not like '%<restricted-source>%'
        and Q.Tags not like '%<source-layout>%'
        and Q.Tags not like '%<fastest-code>%'
        and Q.Tags not like '%<fastest-algorithm>%'
        and Q.Tags not like '%<metagolf>%'
        and Q.Tags not like '%<answer-chaining>%'
        and Q.Tags not like '%<programming-puzzle>%'
        and Q.Tags not like '%<test-battery>%'
        and Q.Tags not like '%<quine>%'
        and Q.Tags not like '%<self-referential>%'
        and Q.Body not like '%bonus%'
        and Q.Body not like '%Bonus%'
)

select p.Id,
    p.ParentId,
    DATEDIFF(second,{d '1970-01-01'},p.CreationDate) as CreationDate,
    LEFT(p.Body,CHARINDEX(char(10),p.Body,1)-1) as FirstLine
from Posts p
inner join CodeGolfQs q
on p.ParentId = q.Id
where p.PostTypeId = 2
    and p.CommunityOwnedDate is null
    and p.DeletionDate is null
    and p.OwnerUserId is not null
    and p.Body not like '%bonus%'
    and (
        p.Body like '<h_>%'
        or p.Body like '<p><strong>%'
    )
    and lower(left(p.Body, charindex(char(10), p.Body)-1)) like '%byte%'
    and p.Id < ##maxID:int?999999##
order by p.Id DESC

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results