<commit_before>// vim: noet ts=4 sw=4
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#include "parse.h"
#include "parson.h"

ol_stack *parse_catalog_json(const char *all_json, const char board) {
	JSON_Value *catalog = json_parse_string(all_json);

	if (json_value_get_type(catalog) != JSONArray)
		printf("Well, the root isn't a JSONArray.\n");

	ol_stack *matches = NULL;
	matches = calloc(1, sizeof(ol_stack));

	JSON_Array *all_objects = json_value_get_array(catalog);

	int i;
	for (i = 0; i < json_array_get_count(all_objects); i++) {
		JSON_Object *obj = json_array_get_object(all_objects, i);
		printf("Page: %lu\n", (long)json_object_get_number(obj, "page"));

		JSON_Array *threads = json_object_get_array(obj, "threads");
		int j;
		for (j = 0; j < json_array_get_count(threads); j++) {
			JSON_Object *thread = json_array_get_object(threads, j);
			const int thread_num = json_object_get_number(thread, "no");
			const char *file_ext = json_object_get_string(thread, "ext");
			const char *post = json_object_get_string(thread, "com");

			if ((file_ext != NULL && strstr(file_ext, "webm")) ||
				(post != NULL && strstr(post, "webm"))) {<commit_msg>strcasestr instead of strstr<commit_after>// vim: noet ts=4 sw=4
#define _GNU_SOURCE
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#include "parse.h"
#include "parson.h"

ol_stack *parse_catalog_json(const char *all_json, const char board) {
	JSON_Value *catalog = json_parse_string(all_json);

	if (json_value_get_type(catalog) != JSONArray)
		printf("Well, the root isn't a JSONArray.\n");

	ol_stack *matches = NULL;
	matches = calloc(1, sizeof(ol_stack));

	JSON_Array *all_objects = json_value_get_array(catalog);

	int i;
	for (i = 0; i < json_array_get_count(all_objects); i++) {
		JSON_Object *obj = json_array_get_object(all_objects, i);
		printf("Page: %lu\n", (long)json_object_get_number(obj, "page"));

		JSON_Array *threads = json_object_get_array(obj, "threads");
		int j;
		for (j = 0; j < json_array_get_count(threads); j++) {
			JSON_Object *thread = json_array_get_object(threads, j);
			const int thread_num = json_object_get_number(thread, "no");
			const char *file_ext = json_object_get_string(thread, "ext");
			const char *post = json_object_get_string(thread, "com");

			if ((file_ext != NULL && strstr(file_ext, "webm")) ||
				(post != NULL && strcasestr(post, "webm"))) {
{'fraction_non_alphanumeric': 0.15014638226683397, 'fraction_numerical': 0.004182350480970306, 'mean_word_length': 5.607734806629834, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1396168', 'n_tokens_mistral': 944, 'n_tokens_neox': 884, 'n_words': 203}