274 lines
8.3 KiB
Markdown
274 lines
8.3 KiB
Markdown
# FlixInfo
|
||
|
||
[](https://badge.fury.io/js/flixinfo)
|
||
[](https://opensource.org/licenses/ISC)
|
||
|
||
Get detailed movie and TV series information using Netflix IDs. FlixInfo is a Node.js library that fetches comprehensive movie/TV show data by combining Netflix content information with The Movie Database (TMDb) data.
|
||
|
||
## 🎯 Features
|
||
|
||
- **Netflix Content Details**: Fetch movie/TV show information directly from Netflix
|
||
- **TMDb Integration**: Enrich data with The Movie Database information including details, credits, images, and trailers
|
||
- **Multi-language Support**: Support for different languages via TMDb API
|
||
- **Regional Support**: Works with both Turkish (tr.flixable.com) and Global (flixable.com) Netflix content
|
||
- **Google Search Fallback**: Automatic Google search integration when direct TMDb lookup fails
|
||
- **Comprehensive Data**: Returns Netflix data + TMDb data + IMDB ratings in a single response
|
||
|
||
## 📦 Installation
|
||
|
||
```bash
|
||
npm install flixinfo
|
||
```
|
||
|
||
## 🚀 Quick Start
|
||
|
||
```javascript
|
||
const FlixInfo = require('flixinfo');
|
||
|
||
// Initialize with your TMDb API key
|
||
const flixInfo = new FlixInfo('YOUR_TMDB_API_KEY');
|
||
|
||
// Get movie/TV show information
|
||
async function getMovieInfo() {
|
||
try {
|
||
const info = await flixInfo.getNetflixInfo(
|
||
81151514, // Netflix ID
|
||
'en-EN', // Language for TMDb API
|
||
'tr' // Netflix location ('tr' for Turkey, other for global)
|
||
);
|
||
console.log(info);
|
||
} catch (error) {
|
||
console.error('Error:', error);
|
||
}
|
||
}
|
||
|
||
getMovieInfo();
|
||
```
|
||
|
||
## 🔧 API Reference
|
||
|
||
### Constructor
|
||
|
||
```javascript
|
||
new FlixInfo(tmdbApiKey)
|
||
```
|
||
|
||
**Parameters:**
|
||
- `tmdbApiKey` (string): **Required** - Your TMDb API key. Get one from [https://www.themoviedb.org/settings/api](https://www.themoviedb.org/settings/api)
|
||
|
||
### Methods
|
||
|
||
#### `getNetflixInfo(netflixId, theMovieDbLanguage, netflixLocation)`
|
||
|
||
Fetches comprehensive movie/TV show information.
|
||
|
||
**Parameters:**
|
||
- `netflixId` (number): **Required** - Netflix content ID
|
||
- `theMovieDbLanguage` (string): **Required** - Language code for TMDb API (e.g., 'en-EN', 'tr-TR')
|
||
- `netflixLocation` (string): **Required** - Netflix location ('tr' for Turkish content, anything else for global)
|
||
|
||
**Returns:**
|
||
Returns a Promise that resolves to an object containing:
|
||
|
||
```javascript
|
||
{
|
||
result: 1, // Success indicator
|
||
error: 0, // Error indicator
|
||
watch: "movie" | "tv", // Content type
|
||
|
||
imdb: {
|
||
id: "string", // IMDB ID (if available)
|
||
rate: "string" // IMDB rating (if available)
|
||
},
|
||
|
||
netflix: {
|
||
title: "string", // Title on Netflix
|
||
year: "string", // Release year
|
||
poster_url: "string", // Netflix poster URL
|
||
age_rates: "string", // Age rating
|
||
season: "string", // Season count (for TV shows)
|
||
runtime: "string", // Runtime (for movies)
|
||
overview: "string", // Description/overview
|
||
genres: ["string"], // Array of genres
|
||
cast: ["string"] // Array of cast members
|
||
},
|
||
|
||
tmdb: {
|
||
google_search: boolean, // Whether Google search was used
|
||
details: {}, // TMDb details object
|
||
credits: {}, // TMDb credits object
|
||
images: {}, // TMDb images object
|
||
trailers: {} // TMDb trailers object
|
||
}
|
||
}
|
||
```
|
||
|
||
## 📍 Finding Netflix IDs
|
||
|
||
You can find Netflix IDs using:
|
||
1. **Flixable**: Browse [tr.flixable.com](https://tr.flixable.com) (Turkish) or [flixable.com](https://flixable.com) (Global)
|
||
2. **Netflix URL**: The ID is the number in the Netflix URL: `https://www.netflix.com/title/NETFLIX_ID`
|
||
3. **Browser Extensions**: Various browser extensions can show Netflix IDs
|
||
|
||
## 🌍 Supported Languages
|
||
|
||
TMDb API supports various languages. Common examples:
|
||
- `'en-EN'` - English
|
||
- `'tr-TR'` - Turkish
|
||
- `'de-DE'` - German
|
||
- `'fr-FR'` - French
|
||
- `'es-ES'` - Spanish
|
||
- `'it-IT'` - Italian
|
||
|
||
See [TMDb API Documentation](https://developers.themoviedb.org/3/getting-started/languages) for complete list.
|
||
|
||
## 🎬 Usage Examples
|
||
|
||
### Basic Movie Information
|
||
|
||
```javascript
|
||
const FlixInfo = require('flixinfo');
|
||
const flixInfo = new FlixInfo('YOUR_TMDB_API_KEY');
|
||
|
||
// Get movie info (Inception - Netflix ID: 70131314)
|
||
const movieInfo = await flixInfo.getNetflixInfo(70131314, 'en-EN', 'tr');
|
||
console.log(`Title: ${movieInfo.netflix.title}`);
|
||
console.log(`Year: ${movieInfo.netflix.year}`);
|
||
console.log(`Genres: ${movieInfo.netflix.genres.join(', ')}`);
|
||
```
|
||
|
||
### TV Series Information
|
||
|
||
```javascript
|
||
// Get TV series info (Ragnarok - Netflix ID: 80232926)
|
||
const seriesInfo = await flixInfo.getNetflixInfo(80232926, 'en-EN', 'tr');
|
||
console.log(`Series: ${seriesInfo.netflix.title}`);
|
||
console.log(`Seasons: ${seriesInfo.netflix.season}`);
|
||
console.log(`First Air Date: ${seriesInfo.tmdb.details.first_air_date}`);
|
||
```
|
||
|
||
### Turkish Content
|
||
|
||
```javascript
|
||
// Get Turkish content with Turkish language support
|
||
const turkishInfo = await flixInfo.getNetflixInfo(81151514, 'tr-TR', 'tr');
|
||
console.log(`Türkçe Başlık: ${turkishInfo.netflix.title}`);
|
||
console.log(`Tür: ${turkishInfo.netflix.genres.join(', ')}`);
|
||
console.log(`Özet: ${turkishInfo.netflix.overview}`);
|
||
```
|
||
|
||
### Error Handling
|
||
|
||
```javascript
|
||
const FlixInfo = require('flixinfo');
|
||
|
||
try {
|
||
const flixInfo = new FlixInfo('YOUR_TMDB_API_KEY');
|
||
const info = await flixInfo.getNetflixInfo(81151514, 'en-EN', 'tr');
|
||
console.log(info);
|
||
} catch (error) {
|
||
console.error('Error occurred:', error);
|
||
|
||
// Common errors:
|
||
// - 'missing tmdb api key' - Invalid or missing API key
|
||
// - 'this content was not found!' - Netflix ID not found
|
||
// - 'tmdb api connection error' - TMDb API connectivity issues
|
||
// - 'language parameters not found' - Invalid language parameter
|
||
}
|
||
```
|
||
|
||
## 🧪 Testing
|
||
|
||
Run the test suite:
|
||
|
||
```bash
|
||
npm test
|
||
```
|
||
|
||
The tests use Mocha, Chai, and Nock for HTTP mocking. Tests cover:
|
||
- API key validation
|
||
- Movie and TV show information retrieval
|
||
- Error handling
|
||
- Connection failures
|
||
|
||
## 🛠️ Development
|
||
|
||
### Project Structure
|
||
|
||
```
|
||
flixinfo/
|
||
├── lib/
|
||
│ ├── index.js # Main FlixInfo class
|
||
│ └── module.js # Helper functions (IMDB, TMDb, Google search)
|
||
├── config/
|
||
│ └── index.js # Configuration constants
|
||
├── example/
|
||
│ └── getinfo.js # Usage example
|
||
├── test/
|
||
│ └── flixinfo.test.js # Test suite
|
||
├── index.js # Entry point
|
||
└── package.json
|
||
```
|
||
|
||
### Dependencies
|
||
|
||
- **cheerio**: Server-side HTML parsing
|
||
- **request**: HTTP client for API calls
|
||
- **config**: Configuration management
|
||
|
||
### Dev Dependencies
|
||
|
||
- **mocha**: Test framework
|
||
- **chai**: Assertion library
|
||
- **nock**: HTTP mocking for tests
|
||
|
||
## 📝 Notes
|
||
|
||
### Data Sources
|
||
|
||
1. **Netflix Data**: Sourced from Flixable (Netflix catalog)
|
||
2. **TMDb Data**: Enriched with The Movie Database
|
||
3. **IMDB Data**: Cross-referenced with IMDB ratings
|
||
4. **Google Search**: Fallback when TMDb lookup fails
|
||
|
||
### Limitations
|
||
|
||
- Requires active Netflix content (removed content won't be found)
|
||
- Dependent on Flixable availability
|
||
- TMDb API rate limits apply
|
||
- Some content may lack complete information
|
||
|
||
### Error Scenarios
|
||
|
||
- Netflix content not found or removed
|
||
- Invalid TMDb API key
|
||
- Network connectivity issues
|
||
- Flixable service unavailability
|
||
- TMDb API downtime
|
||
|
||
## 🤝 Contributing
|
||
|
||
1. Fork the repository
|
||
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
||
3. Commit your changes (`git commit -m 'Add amazing feature'`)
|
||
4. Push to the branch (`git push origin feature/amazing-feature`)
|
||
5. Open a Pull Request
|
||
|
||
## 📄 License
|
||
|
||
This project is licensed under the ISC License - see the [LICENSE](LICENSE) file for details.
|
||
|
||
## 🔗 Links
|
||
|
||
- [GitHub Repository](https://github.com/sbilketay/flixinfo)
|
||
- [The Movie Database API](https://developers.themoviedb.org/3)
|
||
- [Flixable (Turkish)](https://tr.flixable.com)
|
||
- [Flixable (Global)](https://flixable.com)
|
||
|
||
## 🐛 Issues
|
||
|
||
Found a bug or have a feature request? Please [open an issue](https://github.com/sbilketay/flixinfo/issues).
|
||
|
||
---
|
||
|
||
**Disclaimer**: This library is for educational purposes only. Respect Netflix's terms of service and all applicable copyright laws. |