tinder-api-ts
v0.2.0
Published
Unofficial Tinder API wrapper for Nodejs and Deno.
Maintainers
Readme
tinder-api
tinder-api is an unofficial library to interact with Tinder's API. Designed to work seamlessly with both Node.js and Deno, it simplifies the process of performing actions such as liking, disliking, and retrieving profiles, as well as accessing search results.
Features
- Perform searches for profiles.
- Like or dislike profiles.
- Retrieve authenticated user profile information.
- Designed for flexibility and easy integration.
Installation
Node.js
Install the package via npm:
npm install tinder-api-tsyarn add tinder-api-tspnpm i tinder-api-tsDeno
Import the package directly from the repository URL:
deno add jsr:@miguelo/tinder-apiAuthentication Token
To use the tinder-api, you need to retrieve your X-AUTH-TOKEN from Tinder web. Here's how you can obtain it:
Steps to Get Your Token:
- Open your browser and navigate to the Tinder website.
- Open Developer Tools (usually by pressing
F12orCtrl+Shift+I). - Go to the Application tab.
- Locate IndexedDB in the Storage section.
- Find the
keyval-storedatabase and thekeyvalstore. - Search for the key
persist::mfa. - Extract the
authTokenvalue from the result.
Alternatively, use this script in your browser console to retrieve the token:
const dbName = 'keyval-store';
const storeName = 'keyval';
const key = 'persist::mfa';
const dbPromise = indexedDB.open(dbName);
dbPromise.onsuccess = function(event) {
const db = event.target.result;
// Creamos una transacción de lectura
const transaction = db.transaction([storeName], 'readonly');
// Obtenemos el objeto store
const objectStore = transaction.objectStore(storeName);
// Realizamos la petición para obtener el valor
const request = objectStore.get(key);
request.onsuccess = function(event) {
const result = JSON.parse(event.target.result);
console.log(result.authToken)
};
request.onerror = function(event) {
console.error('Error al obtener el valor:', event.target.error);
};
};
dbPromise.onerror = function(event) {
console.error('Error al abrir la base de datos:', event.target.error);
};Usage
Init API client example
import { TinderAPI } from "tinder-api";
const api = new TinderAPI({ xAuthToken: "your_auth_token" });Search profiles and give like example
const results = await api.search()
const profile = results.data.data.results[0]
// Like a profile
const likeResponse = await api.like({
s_number: profile.s_number,
userId: profile.user._id,
liked_content_id: profile.user.photos.at(0)?.id!,
liked_content_type: 'photo',
});API Methods
| Method | Description |
|--------|-------------|
| search(params?: TinderSearchParams): Promise<TinderResponse<TinderSearchResponse>> | Search for profiles. |
| like(params: TinderLikeParams): Promise<TinderResponse<TinderLikeResponse>> | Like a profile. |
| dislike(params: TinderDislikeParams): Promise<TinderResponse<TinderDislikeResponse>> | Dislike a profile. |
| profile(params?: TinderProfileParams): Promise<TinderResponse<TinderProfileResponse>> | Retrieve authenticated user profile. |
Interfaces
TinderSearchParams
Parameters for searching profiles.
| Property | Type | Description |
|---------------|------------|----------------------------------------|
| locale | string | The locale to use for the search. |
TinderLikeParams
Parameters for liking a profile.
| Property | Type | Description |
|--------------------|------------|----------------------------------------|
| userId | string | The ID of the profile to like. |
| s_number | string | The session number for the request. |
| liked_content_id | string | The ID of the content to like. |
| liked_content_type | string | The type of content to like. |
TinderDislikeParams
Parameters for disliking a profile.
| Property | Type | Description |
|------------|------------|----------------------------------------|
| userId | string | The ID of the profile to dislike. |
| s_number | string | The session number for the request. |
TinderProfileParams
Parameters for retrieving the authenticated user profile.
| Property | Type | Description |
|------------|------------|----------------------------------------|
| locale | string | The locale to use for the profile. |
| scopes | string[] | Additional data to include in the response. |
Error Handling
The library throws detailed errors if a request fails. Wrap your calls in try-catch to handle exceptions gracefully.
try {
const results = await api.search();
console.log(results);
} catch (error) {
console.error("Error:", error.message);
}License
This project is licensed under the MIT License. See the LICENSE file for more details.
Contributing
Contributions are welcome! If you encounter issues, have ideas for improvements, or want to contribute new features, feel free to open an issue or submit a pull request on the GitHub repository.
Guidelines:
- Fork the repository and create a new branch for your feature or bug fix.
- Ensure your code adheres to the project's coding standards.
- Write tests for any new functionality or changes.
- Submit a detailed pull request describing your changes.
Thank you for your contributions!
