| | import subprocess |
| | import os |
| |
|
| | def download_fb_content(url, cookies_path): |
| | """ |
| | Downloads content from a direct Facebook URL using gallery-dl. |
| | |
| | Args: |
| | url (str): The direct URL to the Facebook content. |
| | cookies_path (str): The path to the cookies.txt file. |
| | """ |
| | |
| | |
| | if not os.path.exists(cookies_path): |
| | print(f"Error: Cookies file not found at '{cookies_path}'") |
| | print("Please ensure the file exists and the path is correct.") |
| | return |
| |
|
| | |
| | print("-" * 20) |
| | print(f"Running gallery-dl for: {url}") |
| | print("-" * 20) |
| | |
| | cmd = [ |
| | "gallery-dl", |
| | "--cookies", cookies_path, |
| | url |
| | ] |
| | |
| | try: |
| | |
| | subprocess.run(cmd, check=True) |
| | print("\nDownload completed successfully.") |
| | |
| | except FileNotFoundError: |
| | print("\n--- ERROR ---") |
| | print("Command 'gallery-dl' not found.") |
| | print("Please make sure gallery-dl is installed and accessible in your system's PATH.") |
| | |
| | except subprocess.CalledProcessError as e: |
| | print("\n--- ERROR ---") |
| | print(f"gallery-dl returned an error (Exit Code: {e.returncode}).") |
| | print("This could be due to an invalid URL, private content, or expired cookies.") |
| | print("Try running the command directly in your terminal for more detailed error messages.") |
| |
|
| | |
| |
|
| | |
| | |
| | cookies_file = "cookies.txt" |
| |
|
| | print("--- Downloading Facebook Story Content ---") |
| | story_url = "https://www.facebook.com/stories/108639588358960/UzpfSVNDOjE1NjIwNDMzMjg0ODk0ODA=/?view_single=false" |
| | download_fb_content(story_url, cookies_file) |