{"id":20147277,"url":"https://github.com/machphy/facebook_sentiment_analysis_token","last_synced_at":"2026-06-08T17:32:02.307Z","repository":{"id":247471764,"uuid":"825940105","full_name":"machphy/facebook_sentiment_analysis_token","owner":"machphy","description":"analyze the sentiment of Facebook posts and visualize the results in a histogram. It connects to Facebook's Graph API to fetch posts, preprocesses the text, performs sentiment analysis, and displays a histogram of sentiment scores","archived":false,"fork":false,"pushed_at":"2024-07-08T19:59:16.000Z","size":253,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-03T00:22:32.841Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/machphy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-08T19:53:53.000Z","updated_at":"2024-09-03T17:12:41.000Z","dependencies_parsed_at":"2024-07-09T00:43:51.157Z","dependency_job_id":"9f86957c-2d59-4fed-a020-ba53389fe618","html_url":"https://github.com/machphy/facebook_sentiment_analysis_token","commit_stats":null,"previous_names":["machphy/facebook_sentiment_analysis","machphy/facebook_sentiment_analysis_token"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/machphy/facebook_sentiment_analysis_token","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/machphy%2Ffacebook_sentiment_analysis_token","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/machphy%2Ffacebook_sentiment_analysis_token/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/machphy%2Ffacebook_sentiment_analysis_token/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/machphy%2Ffacebook_sentiment_analysis_token/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/machphy","download_url":"https://codeload.github.com/machphy/facebook_sentiment_analysis_token/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/machphy%2Ffacebook_sentiment_analysis_token/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34073747,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-08T02:00:07.615Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T22:28:17.713Z","updated_at":"2026-06-08T17:32:02.280Z","avatar_url":"https://github.com/machphy.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Facebook Posts Sentiment Analysis\n\nThis project analyzes the sentiment of your Facebook posts and visualizes the results using a histogram.\n\n## How It Works\n\n1. **Connect to Facebook:**\n   - The code connects to the Facebook Graph API using an access token to access your Facebook data.\n\n2. **Fetch Your Posts:**\n   - It retrieves posts from your Facebook profile.\n\n3. **Save Posts to a File:**\n   - The posts are saved into a file named `posts.json`.\n\n4. **Load Posts from the File:**\n   - The code reads the `posts.json` file to load the posts back into the program for further processing.\n\n5. **Preprocess Text:**\n   - Each post's text is cleaned by removing special characters and converting all letters to lowercase.\n\n6. **Perform Sentiment Analysis:**\n   - The cleaned-up text is analyzed to determine its sentiment, indicating whether the text is positive, negative, or neutral.\n\n7. **Visualize Results:**\n   - A histogram is created to show the distribution of sentiment scores, helping visualize the overall sentiment of your posts.\n\n## Requirements\n\n- Python 3.x\n- `facebook-sdk`\n- `textblob`\n- `matplotlib`\n\n\n## Usage\n\n1. Set your Facebook access token in the code:\n   ```python\n   access_token = \"YOUR_USER_ACCESS_TOKEN\"\n   ```\n\n2. Run the script:\n   ```sh\n   python script_name.py\n   ```\n\n3. The script will:\n   - Fetch your Facebook posts\n   - Save them to `posts.json`\n   - Load the posts from `posts.json`\n   - Preprocess and analyze the text for sentiment\n   - Display a histogram of the sentiment analysis results\n\n## Notes\n\n- Ensure you have the required permissions (`user_posts`) for the access token to fetch your posts.\n- The access token must be kept secure and should not be shared publicly.\n\n## Example\n\nHere's an example of how the histogram might look:\n\n![Sentiment Analysis Histogram]\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n```\n\nThis `README.md` file provides a clear and concise explanation of how the project works, the requirements, installation steps, usage instructions, and an example output. Make sure to replace `\"YOUR_USER_ACCESS_TOKEN\"` with your actual access token and update the repository URL and script name accordingly.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmachphy%2Ffacebook_sentiment_analysis_token","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmachphy%2Ffacebook_sentiment_analysis_token","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmachphy%2Ffacebook_sentiment_analysis_token/lists"}