You can access search results via JSON API by adding format=json
to your query:
https://codesearch.val.run/$%7Burl%7D?q=api&page=26&format=json
For typeahead suggestions, use the /typeahead
endpoint:
https://codesearch.val.run/typeahead?q=api
Returns an array of strings in format "username" or "username/projectName"
Found 11824 results for "api"(803ms)
79// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
80async function fetchRedditPost(postUrl: string, limit: number) {
81const api = postUrl.replace(/\/?$/, "")
82+ `.json?limit=${limit}&raw_json=1`;
83const [postListing, commentListing] = await fetch(api, {
84headers: { "User-Agent": "val-town-reddit-scraper" },
85}).then(r => r.json());
271<title>The S.M.A.R.T Hive</title>
272<meta name="viewport" content="width=device-width, initial-scale=1">
273<link rel="preconnect" href="https://fonts.googleapis.com">
274<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
275<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600&display=swap" rel="stylesheet">
276<script src="https://esm.town/v/std/catch"></script>
277</head>