chriskyfung / AutoFetcher-IG-Stories-to-GDrive

A simple tool to save IG Stories of any user to your Google Drive with just Google Sheets and Apps Script
https://chriskyfung.github.io/AutoFetcher-IG-Stories-to-GDrive/
GNU Affero General Public License v3.0
102 stars 19 forks source link
google-apps-script google-drive google-sheets-library instagram instagram-bot instagram-downloader instagram-stories instagram-story

IG Stories to GDrive Fetcher

built with clasp code style: prettier license: AGPL-3.0 Health Status Last Tested Date

A no-code tool that lets you easily save the Instagram Stories of any user to your Google Drive. You don’t need to install anything on your computer or phone, just use Google Sheets and Google Apps Script as a cloud tool to fetch the Stories you want.

[!IMPORTANT] Release On 2024-03-15 To use the latest features and bug fixes, please update the Library Version of your Google Script to the latest one or create a new copy of the Google Sheet template with the name V10 or higher.

[!TIP] Manual upgrade from V8 to V9 or higher If you prefer to keep your existing Google Sheet file, you can manually update the Apps Script by following these steps:

  1. Open the Apps Script editor from your Google Sheet file.
  2. In the left panel, click on the IGStoriesToGDrive library under the Libraries section.
  3. From the Version dropdown, select 10 and click Save.
  4. Delete the ui.gs file from the project files.
  5. Open the code.gs file and add the following code to enable the new features.

    function moveSelected() {
      const IGSF = IGStoriesToGDriveDEV.getInstance();
      IGSF.moveSelected();
    }
    
    function onOpen() {
      const IGSF = IGStoriesToGDriveDEV.getInstance();
      IGSF.initUi();
    }

[!NOTE] Release On 2023-02-16
Thanks for the contributions from hidehiro98❤ We can now save downloaded files from different IG users to separate Google Drive folders 📁.

🗄️ Table of Contents

📡 Introduction

This project lets you use Google Sheets and Google Apps Script, a platform that allows you to create web apps with JavaScript, to make a cloud tool that saves the latest Instagram Stories of any user you choose to your Google Drive.

With this tool, you can:

This project is free and open-source. You can find the source code, the Google Sheet template, and the step-by-step instructions on how to use the tool in this repository. For more information, please visit the project website.

🛹 Usage

[!NOTE] From build21110a onwards, the Apps Script has been redesigned to work with a Google Sheet file as a user interface.

To get started, click the button below to make a copy of our Google Sheet template to your Google Drive.

Make Copy

The spreadsheet consists of the following three sheets:

Sheet Name Description
Subscriptions A table where you can list the Instagram users and their IDs that you want to subscribe to.
Logs A log sheet that records the file download activities.
Settings A tabular form where you can fill in the values of options and parameters for running the script.

[!NOTE] With Library V10, the script now leverages the time zone setting configured in Google Sheets, ensuring accurate timestamps irrespective of your geographical location. To modify the time zone for a specific spreadsheet, please refer to this Google Support page. By aligning the script with your spreadsheet's time zone, you can seamlessly manage tasks and track time entries with utmost precision.

You can use the Google Sheet file and bind our script to it in the following ways:

📩 Set Up Subscriptions

To subscribe to the stories of your favorite Instagram users, you need to add their names and IDs to the table on the “Subscriptions” sheet.

The Instagram User ID is a unique number that identifies each Instagram user. You can find the ID of any user by using the ID finder powered by The Code of a Ninja.

[!TIP] For example, to subscribe to the stories from BBC News’s Instagram account, you can enter bbcnews as the name in the first column and 16278726 as the ID in the second column.

The script will fetch the photos and videos from Instagram and upload them to your Google Drive folder whenever you click on the ▶ Run button.

⚙️ Configuration Settings

The “Settings” sheet contains a tabular form where you can enter the values of options and parameters for running the script. Here is a brief explanation of each setting:

Google Drive

[!TIP] You can find the ID in the URL of the folder. For example, if the URL of the folder is https://drive.google.com/drive/folders/1a2b3c4d5e6f7g8h9i0j1k2l3m4n?resourcekey=0-XXXXXCt-XXXXX4WRe1aA, then the folder ID is 1a2b3c4d5e6f7g8h9i0j1k2l3m4n.

Instagram

[!WARNING] Please note that this information may change over time and may not be accurate.

To access the Instagram API, the script needs to send some request header fields that mimic the behavior of a logged-in user on instagram.com. These fields are:

[!Caution] The x-instagram-ajax field has been deprecated from build230214a (Library v7).

🛠️ Advanced Configurations

In addition to the basic configurations outlined above, you can also enable the following advanced configurations:

For more information, please refer to the Advanced Configurations documentation page.

🛡️ Privacy and Security

We respect your privacy and data security. Here are some important points to note:

[!TIP] If you want better protection of your data, you can self-host the code as a standalone project. This way, you can have full control over the code and the data, and you can customize the script according to your needs.

[!CAUTION] If you have any worries about any potential security issues with our script or shared library, please do not use them. We are not responsible for any data loss or damage that may occur from using our tool.

❓ FAQ

If you have any questions or problems with using our tool, please refer to our FAQ section on the project webpage. We have answered some of the most common questions, such as:

  1. How to get the required Instagram headers and cookie for the tool?

  2. What to do if you receive an error message Exception: Request failed for https://i.instagram.com returned code 400.?

  3. What to do if you receive an error message Exception: Unexpected error while getting the method or property getFolderById on object DriveApp.?

If you cannot find the answer to your question in the FAQ section, please feel free to contact us via GitHub issues or discussions. We will try our best to help you. 😊


📋 Changelog

To see the full list of changes made in each release, please refer to the CHANGELOG.md file.

💕 Like my stuff?

If you enjoy using this tool and want to support me in the development, you can buy me a coffee. I would really appreciate it if you could show your appreciation and generosity.

<img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" style="height: 41px !important;width: 174px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;" alt="Buy Me A Coffee" target="_blank" />

⚖️ License

This project is distributed under the AGPL-3.0 license. This means that you are free to use, modify, and share this project, as long as you follow these rules:

You can find the full text of the license in the LICENSE file.