Before you begin, ensure you have met the following requirements:
- Python (Django typically requires Python)
- Django
- Node.js
- npm
- Ionic CLI
- ngrok
- Facebook Developer Account - Create an account to set up your application.
- Instagram Basic Display API - Set up an app on the Facebook Developer Dashboard to obtain API credentials.
- Instagram Account
Clone the repository:
git clone https://github.com/instaboy007/instagram-sentiment-analysis.git
cd instagram-sentiment-analysisRefer [https://developers.facebook.com/docs/instagram-basic-display-api/getting-started/]
- Navigate to backend Directory
cd backend- Create a Virtual Environment
python -m venv venv- Activate the Virtual Environment
venv\scripts\activate- Install Packages from requirements.txt
pip install -r requirements.txt-
Execute the Following Commands:
python
import nltk
nltk.download('vader_lexicon')exit() -
Start the Server
cd server
python manage.py runserver- From the Root Directory Navigate to frontend/app Directory
cd frontend/app- Install Node Modules
npm install-
Replace Client ID and Client Secret from Instagram App created from the Facebook Developer Dashboard in the frontend/src/context/authContext.tsx
-
Run the Ionic Development Server
ionic serveThis will start the Developlment Server running at http://localhost:8100/
-
Install Ngrok ([https://ngrok.com/download]) Extract Zip file to a Directory and Navigate to that directory
-
Open this Directory in cmd (directory with ngrok.exe)
-
Login to [https://dashboard.ngrok.com/login] and from the Left Menu navigate to Getting Started > Your Auth Token. Copy your Auth Token
-
Run the following command to add your authtoken to the default ngrok.yml configuration file
ngrok config add-authtoken <YOUR_AUTH_TOKEN>- Deploy your app online
ngrok http 8100Here the Port is same as the Ionic Development Server
- Copy the
ForwardingLink
Example: Forwarding [https://13a8-2405-201-e033-7054-e08d-ed5c-20f4-b6c9.ngrok-free.app] -> http://localhost:8100
Deployed Link is [https://13a8-2405-201-e033-7054-e08d-ed5c-20f4-b6c9.ngrok-free.app]
Open this in Browser to View the Deployed App.
-
Open frontend/src/context/authContext.tsx replace the redirect_uri with the Deployed Link followed by /authorization route. Example: https://13a8-2405-201-e033-7054-e08d-ed5c-20f4-b6c9.ngrok-free.app/authorization
-
Replace the Valid OAuth Redirect URIs, Deauthorize callback URL, Data Deletion Request URL in the Facebook Developer Portal with the same ([https://13a8-2405-201-e033-7054-e08d-ed5c-20f4-b6c9.ngrok-free.app/authorization]).
-
Open backend/server/server/settings.py replace "https://<YOUR_DEPLOYED_LINK>" with the Deployed Link for ALLOWED_HOSTS and CROSS_ORIGIN_WHITELIST. Example: [https://13a8-2405-201-e033-7054-e08d-ed5c-20f4-b6c9.ngrok-free.app]