An unofficial JavaScript library for you.com.
About • Install • How To Use • License
This project is currently unmaintained as You.com does not have an official public API. When they do, development on You.JS will resume, probably at https://github.com/You-OpenSource/You-JS. In the meantime, this project is archived and will be marked as deprecated on NPM.
Welcome to the the You.JS Library!
This library allows developers to easily access and utilize all of the functionality of the You.com platform through a simple and intuitive JavaScript API. With the library, developers can access a variety of You.com apps and services, including but not limited to:
- The search engine
To get started with You.JS, read install and then how to use.
We hope you enjoy using You.JS!
adapted from YouDotCom's README.md
To install the You.JS library, simply run the following command in your terminal:
npm install youdotjsNote: You.JS is named
youdotjson npm becauseyoujsis already taken andyou.jsis too similar.
You must also download curl-impersonate, put it somewhere, and add an environment variable called CURL_BINARY that points to one of the impersonated curl binaries (such as curl_chrome99 or curl_ff100).
Note: curl-impersonate does not currently work on Windows. If you are on Windows, you can either use WSL or use the curl-impersonate-win.
Alternatively, you may also implement the Fetcher function yourself to bypass CloudFlare's anti-bot measures. I have taken a shortcut and simply used curl-impersonate, but you may use any method you wish. I will explain more in the how to use section.
The Fetcher function is used to create a custom fetcher for the library to use. It is a function that takes a URL and returns a promise that resolves to a string containing the HTML of the page at the given URL. The curlFetch function is an example of a fetcher that uses curl-impersonate to bypass CloudFlare's anti-bot measures.
It is recommended that you use a fetcher that bypasses CloudFlare's anti-bot measures, as the library will not work without one. However, if you do not want to use a fetcher, you may use the httpsFetch function, which uses the https module to fetch the page. However, this will not bypass CloudFlare's anti-bot measures, so the library will not work.
The Fetcher function takes one or two arguments. The first argument is the URL to fetch. The second argument is an optional object containing options for the fetcher. It returns a promise that resolves to a FetcherResponse object.
TODO: Add documentation for all objects
The Fetcher is defined as follows:
type Fetcher = (url: string, options?: FetcherOptions) => Promise<FetcherResponse>;The FetcherOptions object is defined as follows:
interface FetcherOptions {
headers?: { [key: string]: string };
rawHeaders?: string[]; // [key, value, key, value, ...]
method?: string;
body?: string;
timeout?: number;
}The FetcherResponse object is defined as follows:
interface FetcherResponse {
status: number | undefined;
statusText: string | undefined;
headers: { [key: string]: string };
rawHeaders: string[];
body: string;
}To use, for example, httpsFetch, you would do the following:
import { httpsFetch } from 'youdotjs';
httpsFetch('https://example.com').then((response) => {
console.log(response.body);
}).catch((error) => {
console.error(error);
});To use the curlFetch function, you must first download curl-impersonate, put it somewhere, and add an environment variable called CURL_BINARY that points to one of the impersonated curl binaries (such as curl_chrome99 or curl_ff100).
Note: curl-impersonate does not currently work on Windows. If you are on Windows, you can either use WSL or use the curl-impersonate-win.
TODO: Add documentation for search
For now, you can see the Search.ts file for documentation. (I'm originally a Java developer, so this is why all the files are CamelCase.)
Currently not implemented because CloudFlare's restrictions on the YouChat API are too strict.
We also have an active Discord server where you can chat with developers and get help with using the library. Our Discord community is a great place to ask questions, share your projects, and get feedback from other developers.
This project is licensed under the Apache License 2.0 - see the LICENSE file for details
