metaai-sdk 2.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,159 @@
1
+ # Changelog
2
+
3
+ All notable changes to Meta AI Python SDK will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [2.0.0] - 2025-11-22
9
+
10
+ ### ๐ŸŽ‰ Initial Release
11
+
12
+ First stable release of the Meta AI Python SDK with comprehensive features for Meta AI interaction.
13
+
14
+ ### Added
15
+
16
+ - ๐ŸŽฌ **Video Generation Support** - Generate AI videos from text prompts
17
+
18
+ - New `generate_video()` method in `MetaAI` class
19
+ - `VideoGenerator` class for advanced video generation control
20
+ - Automatic token fetching (lsd, fb_dtsg) from cookies
21
+ - Video URL polling with configurable timeout
22
+ - Support for multiple video qualities (HD/SD)
23
+
24
+ - ๐Ÿ” **Automatic Token Management**
25
+
26
+ - Auto-fetch missing `lsd` and `fb_dtsg` tokens from Meta AI
27
+ - No manual token configuration required
28
+ - Seamless integration with existing cookie authentication
29
+
30
+ - ๐Ÿ“š **Enhanced Documentation**
31
+
32
+ - Complete video generation guide (`VIDEO_GENERATION_README.md`)
33
+ - API reference with detailed parameters
34
+ - Multiple usage examples
35
+ - Troubleshooting section
36
+ - Migration guide from old code
37
+
38
+ - ๐Ÿ“ฆ **Clean Project Structure**
39
+ - Organized examples directory
40
+ - Clear separation of concerns
41
+ - Removed temporary/test files
42
+ - Added `.gitignore` for clean repository
43
+
44
+ ### Changed
45
+
46
+ - โ™ป๏ธ Refactored `MetaAI.__init__()` to support automatic token fetching
47
+ - ๐Ÿ“– Updated main README with video generation section
48
+ - ๐Ÿ—๏ธ Improved project structure for better maintainability
49
+
50
+ ### Examples
51
+
52
+ - `examples/simple_example.py` - Basic chat and video generation
53
+ - `examples/video_generation.py` - Comprehensive video examples
54
+ - `examples/test_example.py` - Testing and validation
55
+
56
+ ### Technical Details
57
+
58
+ - Video generation uses GraphQL API with multipart/form-data
59
+ - Dynamic header construction for different request types
60
+ - Recursive JSON parsing for video URL extraction
61
+ - Configurable polling mechanism (max_attempts, wait_seconds)
62
+
63
+ ---
64
+
65
+ ## [1.x.x] - Previous Versions
66
+
67
+ ### Features
68
+
69
+ - Chat with Meta AI (Llama 3)
70
+ - Image generation (FB authenticated users)
71
+ - Real-time internet-connected responses
72
+ - Source citation
73
+ - Streaming support
74
+ - Conversation continuity
75
+ - Proxy support
76
+
77
+ ---
78
+
79
+ ## Future Enhancements
80
+
81
+ ### Planned Features
82
+
83
+ - [ ] Video download functionality
84
+ - [ ] Batch video generation
85
+ - [ ] Video quality selection
86
+ - [ ] Advanced filtering for video URLs
87
+ - [ ] Async/await support for video generation
88
+ - [ ] Rate limiting and retry logic
89
+ - [ ] Video generation progress callbacks
90
+ - [ ] Custom video orientation (landscape/portrait/square)
91
+ - [ ] Video duration control
92
+ - [ ] Style presets for video generation
93
+
94
+ ### Under Consideration
95
+
96
+ - [ ] Video editing capabilities
97
+ - [ ] Frame extraction from generated videos
98
+ - [ ] Video concatenation
99
+ - [ ] Audio generation integration
100
+ - [ ] Video template support
101
+
102
+ ---
103
+
104
+ ## Migration Guide
105
+
106
+ ### From v1.x to v2.0
107
+
108
+ **Video Generation** (NEW):
109
+
110
+ ```python
111
+ # New in v2.0
112
+ from metaai_api import MetaAI
113
+
114
+ ai = MetaAI(cookies=cookies)
115
+ result = ai.generate_video("Generate a video of a sunset")
116
+ ```
117
+
118
+ **Token Management** (IMPROVED):
119
+
120
+ ```python
121
+ # Old way (manual)
122
+ cookies = {
123
+ "datr": "...",
124
+ "lsd": "...", # Had to provide manually
125
+ "fb_dtsg": "..." # Had to provide manually
126
+ }
127
+
128
+ # New way (automatic)
129
+ cookies = {
130
+ "datr": "...",
131
+ "abra_sess": "..."
132
+ # lsd and fb_dtsg auto-fetched!
133
+ }
134
+ ```
135
+
136
+ **Backward Compatibility**:
137
+ All existing v1.x features remain fully compatible. No breaking changes to chat or image generation APIs.
138
+
139
+ ---
140
+
141
+ ## Contributing
142
+
143
+ We welcome contributions! Areas of interest:
144
+
145
+ - Video generation enhancements
146
+ - Performance optimizations
147
+ - Additional features from roadmap
148
+ - Bug fixes
149
+ - Documentation improvements
150
+
151
+ ---
152
+
153
+ ## License
154
+
155
+ MIT License - See LICENSE file for details
156
+
157
+ ---
158
+
159
+ **Meta AI Python SDK** - Built with โค๏ธ for developers
@@ -0,0 +1,292 @@
1
+ # Contributing to Meta AI Python SDK
2
+
3
+ First off, thank you for considering contributing to Meta AI Python SDK! ๐ŸŽ‰
4
+
5
+ ## ๐Ÿ“‹ Table of Contents
6
+
7
+ - [Code of Conduct](#code-of-conduct)
8
+ - [Getting Started](#getting-started)
9
+ - [Development Setup](#development-setup)
10
+ - [How to Contribute](#how-to-contribute)
11
+ - [Pull Request Process](#pull-request-process)
12
+ - [Coding Standards](#coding-standards)
13
+ - [Testing](#testing)
14
+
15
+ ## ๐Ÿ“œ Code of Conduct
16
+
17
+ This project and everyone participating in it is governed by our commitment to providing a welcoming and inclusive environment. Please be respectful and constructive in all interactions.
18
+
19
+ ## ๐Ÿš€ Getting Started
20
+
21
+ 1. **Fork the repository** on GitHub
22
+ 2. **Clone your fork** locally:
23
+ ```bash
24
+ git clone https://github.com/YOUR-USERNAME/meta-ai-python.git
25
+ cd meta-ai-python
26
+ ```
27
+ 3. **Create a branch** for your contribution:
28
+ ```bash
29
+ git checkout -b feature/your-feature-name
30
+ ```
31
+
32
+ ## ๐Ÿ’ป Development Setup
33
+
34
+ ### Prerequisites
35
+
36
+ - Python 3.7 or higher
37
+ - pip or poetry for package management
38
+ - Git for version control
39
+
40
+ ### Install Dependencies
41
+
42
+ ```bash
43
+ # Create virtual environment
44
+ python -m venv venv
45
+
46
+ # Activate virtual environment
47
+ # On Windows:
48
+ venv\Scripts\activate
49
+ # On macOS/Linux:
50
+ source venv/bin/activate
51
+
52
+ # Install package in development mode
53
+ pip install -e .
54
+
55
+ # Install development dependencies
56
+ pip install -e ".[dev]"
57
+ ```
58
+
59
+ ### Project Structure
60
+
61
+ ```
62
+ meta-ai-python/
63
+ โ”œโ”€โ”€ src/metaai_api/
64
+ โ”‚ โ”œโ”€โ”€ __init__.py
65
+ โ”‚ โ”œโ”€โ”€ main.py # Core MetaAI class
66
+ โ”‚ โ”œโ”€โ”€ video_generation.py # Video generation
67
+ โ”‚ โ”œโ”€โ”€ utils.py
68
+ โ”‚ โ”œโ”€โ”€ exceptions.py
69
+ โ”‚ โ””โ”€โ”€ client.py
70
+ โ”œโ”€โ”€ examples/
71
+ โ”œโ”€โ”€ tests/ # Unit tests (coming soon)
72
+ โ”œโ”€โ”€ README.md
73
+ โ””โ”€โ”€ setup.py
74
+ ```
75
+
76
+ ## ๐Ÿค How to Contribute
77
+
78
+ ### Reporting Bugs
79
+
80
+ - **Search existing issues** first to avoid duplicates
81
+ - Use the **bug report template** when creating a new issue
82
+ - Include:
83
+ - Python version
84
+ - Package version
85
+ - Minimal code to reproduce the issue
86
+ - Expected vs actual behavior
87
+ - Error messages/stack traces
88
+
89
+ ### Suggesting Features
90
+
91
+ - **Search existing issues** for similar suggestions
92
+ - Use the **feature request template**
93
+ - Describe:
94
+ - The problem your feature solves
95
+ - Proposed solution
96
+ - Alternative solutions considered
97
+ - Use cases and examples
98
+
99
+ ### Code Contributions
100
+
101
+ We welcome contributions in these areas:
102
+
103
+ 1. **Bug fixes** - Fix reported issues
104
+ 2. **New features** - Implement from roadmap or new ideas
105
+ 3. **Documentation** - Improve guides, docstrings, examples
106
+ 4. **Tests** - Add unit tests, integration tests
107
+ 5. **Performance** - Optimize existing functionality
108
+ 6. **Examples** - Add practical usage examples
109
+
110
+ ## ๐Ÿ”„ Pull Request Process
111
+
112
+ 1. **Update your fork**:
113
+
114
+ ```bash
115
+ git remote add upstream https://github.com/meta-ai-sdk/meta-ai-python.git
116
+ git fetch upstream
117
+ git merge upstream/main
118
+ ```
119
+
120
+ 2. **Make your changes**:
121
+
122
+ - Write clean, readable code
123
+ - Follow existing code style
124
+ - Add docstrings to new functions/classes
125
+ - Update documentation if needed
126
+
127
+ 3. **Test your changes**:
128
+
129
+ ```bash
130
+ # Run examples
131
+ python examples/simple_example.py
132
+
133
+ # Test with different Python versions if possible
134
+ ```
135
+
136
+ 4. **Commit your changes**:
137
+
138
+ ```bash
139
+ git add .
140
+ git commit -m "feat: add video quality selection"
141
+ ```
142
+
143
+ Use conventional commits:
144
+
145
+ - `feat:` - New feature
146
+ - `fix:` - Bug fix
147
+ - `docs:` - Documentation changes
148
+ - `refactor:` - Code refactoring
149
+ - `test:` - Adding tests
150
+ - `chore:` - Maintenance tasks
151
+
152
+ 5. **Push to your fork**:
153
+
154
+ ```bash
155
+ git push origin feature/your-feature-name
156
+ ```
157
+
158
+ 6. **Create Pull Request**:
159
+ - Go to the original repository
160
+ - Click "New Pull Request"
161
+ - Select your fork and branch
162
+ - Fill in the PR template
163
+ - Link related issues
164
+
165
+ ### PR Review Process
166
+
167
+ - Maintainers will review your PR within a few days
168
+ - Address any requested changes
169
+ - Once approved, your PR will be merged!
170
+
171
+ ## ๐Ÿ“ Coding Standards
172
+
173
+ ### Python Style Guide
174
+
175
+ - Follow **PEP 8** style guide
176
+ - Use **type hints** where appropriate
177
+ - Maximum line length: **100 characters**
178
+ - Use **descriptive variable names**
179
+
180
+ ### Code Formatting
181
+
182
+ ```bash
183
+ # Format with black (recommended)
184
+ pip install black
185
+ black src/
186
+
187
+ # Check with flake8
188
+ pip install flake8
189
+ flake8 src/
190
+ ```
191
+
192
+ ### Documentation
193
+
194
+ - Add **docstrings** to all public functions/classes
195
+ - Use **Google-style** docstrings:
196
+
197
+ ```python
198
+ def generate_video(prompt: str, wait_before_poll: int = 10) -> Dict:
199
+ """
200
+ Generate a video from a text prompt.
201
+
202
+ Args:
203
+ prompt: Text description for video generation
204
+ wait_before_poll: Seconds to wait before polling
205
+
206
+ Returns:
207
+ Dictionary with success status and video URLs
208
+
209
+ Raises:
210
+ ValueError: If prompt is empty
211
+
212
+ Example:
213
+ >>> ai = MetaAI(cookies=cookies)
214
+ >>> result = ai.generate_video("sunset")
215
+ """
216
+ ```
217
+
218
+ ## ๐Ÿงช Testing
219
+
220
+ ### Running Tests
221
+
222
+ ```bash
223
+ # Run all tests (when available)
224
+ pytest tests/
225
+
226
+ # Run specific test file
227
+ pytest tests/test_video_generation.py
228
+
229
+ # Run with coverage
230
+ pytest --cov=metaai_api tests/
231
+ ```
232
+
233
+ ### Writing Tests
234
+
235
+ - Add tests for new features
236
+ - Ensure existing tests pass
237
+ - Aim for high code coverage
238
+ - Use meaningful test names
239
+
240
+ ```python
241
+ def test_video_generation_with_valid_prompt():
242
+ """Test video generation with a valid prompt."""
243
+ ai = MetaAI(cookies=test_cookies)
244
+ result = ai.generate_video("test prompt")
245
+ assert result["success"] is True
246
+ ```
247
+
248
+ ## ๐Ÿ“ Documentation Updates
249
+
250
+ When adding features, update:
251
+
252
+ - **README.md** - If it changes core usage
253
+ - **CHANGELOG.md** - Add entry under "Unreleased"
254
+ - **VIDEO_GENERATION_README.md** - For video-related features
255
+ - **Docstrings** - In code
256
+ - **Examples** - Add practical examples
257
+
258
+ ## ๐ŸŽฏ Priority Areas
259
+
260
+ We're especially interested in contributions for:
261
+
262
+ - [ ] Unit tests and test coverage
263
+ - [ ] Async/await support
264
+ - [ ] Video download functionality
265
+ - [ ] Batch processing capabilities
266
+ - [ ] Rate limiting and retry logic
267
+ - [ ] Performance optimizations
268
+ - [ ] Additional examples and tutorials
269
+ - [ ] Documentation improvements
270
+
271
+ ## ๐Ÿ’ก Questions?
272
+
273
+ - **General questions**: Open a GitHub Discussion
274
+ - **Bug reports**: Create an issue with bug template
275
+ - **Feature requests**: Create an issue with feature template
276
+ - **Security issues**: Email contact@meta-ai-sdk.dev
277
+
278
+ ## ๐ŸŒŸ Recognition
279
+
280
+ Contributors will be:
281
+
282
+ - Listed in CHANGELOG.md for their contributions
283
+ - Acknowledged in release notes
284
+ - Added to CONTRIBUTORS.md (coming soon)
285
+
286
+ ## ๐Ÿ“„ License
287
+
288
+ By contributing, you agree that your contributions will be licensed under the MIT License.
289
+
290
+ ---
291
+
292
+ **Thank you for making Meta AI Python SDK better!** ๐Ÿš€
@@ -0,0 +1,28 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Meta AI SDK Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ ---
24
+
25
+ DISCLAIMER:
26
+ This project is an independent implementation and is not officially affiliated
27
+ with, authorized, maintained, sponsored, or endorsed by Meta Platforms, Inc.
28
+ or any of its affiliates or subsidiaries.
@@ -0,0 +1,48 @@
1
+ # MANIFEST.in - Include/Exclude files for distribution
2
+
3
+ # Include documentation
4
+ include README.md
5
+ include LICENSE
6
+ include CHANGELOG.md
7
+ include CONTRIBUTING.md
8
+ include SECURITY.md
9
+ include ARCHITECTURE.md
10
+ include VIDEO_GENERATION_README.md
11
+ include QUICK_REFERENCE.md
12
+
13
+ # Include configuration files
14
+ include pyproject.toml
15
+ include setup.py
16
+ include setup.cfg
17
+ include requirements.txt
18
+
19
+ # Include examples
20
+ recursive-include examples *.py
21
+
22
+ # Include package data
23
+ recursive-include src/metaai_api *.py
24
+
25
+ # Exclude development and build files
26
+ exclude .gitignore
27
+ exclude .gitattributes
28
+ recursive-exclude * __pycache__
29
+ recursive-exclude * *.py[co]
30
+ recursive-exclude * *.so
31
+ recursive-exclude * *.dylib
32
+ recursive-exclude * .DS_Store
33
+
34
+ # Exclude tests and CI
35
+ recursive-exclude tests *
36
+ recursive-exclude .github *
37
+
38
+ # Exclude IDE and editor files
39
+ recursive-exclude * .vscode
40
+ recursive-exclude * .idea
41
+ recursive-exclude * *.swp
42
+ recursive-exclude * *.swo
43
+ recursive-exclude * *~
44
+
45
+ # Exclude temporary files
46
+ recursive-exclude * *.tmp
47
+ recursive-exclude * *.bak
48
+ recursive-exclude * *.log