You can access search results via JSON API by adding format=json
to your query:
https://codesearch.val.run/image-url.jpg%20%22Optional%20title%22?q=fetch&page=13&format=json
For typeahead suggestions, use the /typeahead
endpoint:
https://codesearch.val.run/typeahead?q=fetch
Returns an array of strings in format "username" or "username/projectName"
Found 15083 results for "fetch"(4883ms)
470resetIdleTimer(); setTypingIndicator(true);
471try {
472const response = await fetch(API_URL, {
473method: 'POST',
474headers: { 'Content-Type': 'application/json' },
2// const baseUrl = "https://api.neynar.com/v2/farcaster/";
34export async function fetchNeynarGet(path: string) {
5const res = await fetch(baseUrl + encodeURIComponent(path), {
6method: "GET",
7headers: {
15}
1617export async function fetchNeynarGetPages(path: string, pages: number, dataKey: string) {
18let data: any = [];
19let cursor = "";
20let pagesLeft = pages;
21while (true) {
22const res = await fetchNeynarGet(`${path}&cursor=${cursor}`);
23data = [...data, ...res[dataKey]];
24cursor = res?.next?.cursor;
35//////////
3637export function fetchUser(username: string) {
38return fetchNeynarGet(`user/by_username?username=${username}`).then(r => r.user);
39}
40export function fetchUsersById(fids: string) {
41return fetchNeynarGet(`user/bulk?fids=${fids}`).then(r => r.users);
42}
4344export function fetchUserFeed(fid: number) {
45return fetchNeynarGet(
46`feed?feed_type=filter&filter_type=fids&fids=${fid}&with_recasts=false&with_replies=false&limit=100&cursor=`,
47).then(r => r.casts);
48}
4950export function fetchChannel(channelId: string) {
51return fetchNeynarGet(`channel?id=${channelId}`).then(r => r.channel);
52}
5354export function fetchChannelFeed(channelId: string) {
55return fetchNeynarGet(
56`feed/channels?channel_ids=${channelId}&with_recasts=false&limit=100`,
57).then(r => r.casts);
58}
5960export function fetchChannelsFeed(channelIds: string[]) {
61return fetchNeynarGet(
62`feed/channels?channel_ids=${channelIds.join(",")}&with_recasts=false&limit=100`,
63).then(r => r.casts);