Coder Social home page Coder Social logo

deenuu1 / meta-spy Goto Github PK

View Code? Open in Web Editor NEW
25.0 4.0 9.0 74.82 MB

๐Ÿ‘พ CLI MetaSpy (Facebook, Instagram) scraper and crawler - instagram account, facebook accounts, pages and search

Home Page: https://deenuu1.github.io/meta-spy/

License: Apache License 2.0

Python 93.79% HTML 6.15% CSS 0.06%
cli facebook facebook-login fastapi python python3 rich scraper selenium sqlite sqlite3 typer typer-cli web crawler crawler-python graph css html jinja2

meta-spy's Introduction

Contributors Forks Stargazers Issues MIT License LinkedIn


Meta Spy

Meta Spy is a versatile Python-based tool designed to scrape various data from Instagram profiles and Facebook profiles, pages and search results. Whether you need basic information or want to delve deep into a user's activity, Facebook Spy has you covered.

Report Bug ยท Request Feature

instagram full homepage details

Info

If you're using a Facebook account with a custom ID in the URL (e.g., https://www.facebook.com/zuck), Facebook Spy will work smoothly. However, for accounts with default IDs in the URL, certain scrapers may not function as expected. These include scrapers for work and education, contact data, visited places, family members, recent places, reviews, and likes. Rest assured, we're actively working to resolve this issue

About The Project

The project, known as "Meta Spy," is a powerful and versatile tool designed to gather information from Instagram profiles, Facebook profiles, pages and search results.

The project is under constant development to improve its functionality and address any issues that may arise.

One notable limitation of the tool is that some scrapers may not work correctly for profiles with default account IDs in the URL, such as "https://www.facebook.com/profile.php?id=100063142210972." These scrapers include work and education history, contact data, visited places, family members, recent places, reviews, and likes. However, this issue does not occur for profiles with custom IDs in the URL, like "https://www.facebook.com/zuck.".

Key Features

  • Login - Perform a secure two-step verification process to log in to Facebook account with enhanced security settings or log in to Facebook account using the default login method.
  • Scrape details like: friend list, images, recent places, videos, reels, reviews, posts, likes, groups, events etc.
  • Local web application - User is able to run a loval web application to browse scraped data, create notes for specified Person object and easly search details in web.
  • Video downloader - download all scraped videos from facebook account or just by add passed url.
  • Create a graphical representation of connections between different Facebook profiles based on their friendships.
  • Utilize a free open-source language model to generate a concise summary of a Facebook user's infromation based on the scraped data.
  • Initiate a friend crawler for a specified Facebook account. Gether data about friends and contunue the process for subsequent users in the queue.
  • Save scraped data for a specified Facebook user to PDF file for documentation and anylysis.
  • Running scrapers in parallel to speed up the data collection process
  • Save all scraped data to JSON files and database
  • Scrape image urls and download them from Instagram profile and save data to JSON file
  • Scrape Instagram profile stats (number of posts, number of followers, number of following)

Built With

  • Python
    • Typer
    • FastAPI
    • Selenium
  • SQLite
  • HTML / CSS / Bootstrap5

Getting Started

Installation

  1. Clone git repository
git clone https://github.com/DEENUU1/meta-spy.git
  1. Create dotenv file and add required data
cp .env_example .env
  1. Install all requirements
pip install -r requirements.txt
  1. Change directory to metaspy to run commands
cd metaspy

Tests

To run pytests use this command

pytest

Examples

This is just a few examples of how you can use this tool. For more comments check Documentation

Version

python main.py version

Logo

Login

python main.py login-2-step

OR

python main.py login

Logo

Search

python main.py fb-search <"Search Query"> <results> <option_1> <option_2> ... 

Options:
--post # Search for posts based on given query
--results # Number of results 
--people # Search for people based on given query
--group # Search for group based on given query
--place # Search for place based on given query
--event # Search for event based on given query
--page # Search for page based on given query

Logo

Scrape Facebook account/page

python main.py fb-account <facebook_id> <option_1> <option_2> ...

Options:
--work # Scrape work and education information from the given facebook account
--contact # Scrape contact data from the given facebook account
--location # Scrape location data from the given facebook account
--family # Scrape family members data from the given facebook account
--name # Scrape full name from the given facebook account
--friends # Scrape friends list from the given facebook account ๐Ÿ›‘ Page not support
--images # Scrape images from the given facebook account 
--recent # Scrape recent places from the given facebook account ๐Ÿ›‘ Page not support
--reels # Scrape urls for reels from the given facebook account
--reviews # Scrape reviews from the given facebook account
--videos # Scrape urls for videos from the given facebook account
--da # Download all videos from the given facebook account
--dn # Download only new videos from the given facebook account
--posts # Scrape all posts from the given facebook account
--details # Scrape details of posts from the given facebook account
--likes # Scrape likes from the given facebook account
--groups # Scrape groups from the given facebook account
--events # Scrape events from the given facebook account

Scrape Instagram account

python  main.py insta-account <id> <option_1> <option_2> ...

Options:
--images
--stats

Friend crawler

This command works similarly to the command that scrapes data about a given user's friends list. The difference, however, is that after scraping and creating Friend objects, it also creates objects for the CrawlerQueue model and after successfully scraping friends for one user, it proceeds to scraping the list of friends for the next user in the queue.

python main.py friend-crawler <facebook_id>

Logo

Logo

Graph

Graph of connections between Person objects based on ther friends.

python main.py graph

Logo

License

See LICENSE.txt for more information.

meta-spy's People

Contributors

deenuu1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

meta-spy's Issues

Pytest

  • Model QUeue
  • Repository

Pipelines

Move pipelines to separated functions instead of using them as a class methods

Family

  • Scrape relation ship status
  • Scrape family members

Facebook login

  • Create a class Facebook login and change functions into methods
  • Add first command to log in to the facebook

Relations

  • Add method to scrape data about first user
  • Scraped user should has relations to users from friends list

Queue of users to scrape

  • Create a queue with a list of users to scrape
  • Model queue
  • SQLite to store queue
  • After scraping all friends from 1 user it should start to scrape another user's friends and also add them to the queue

elastic pipelines

Every class should has a one big pipeline to do all possible operations and also all extract method should has own pipeline to do 1 specified task

Pytest

  • First fix imports
  • Uncomment tests for models
  • Add tests for repository.py
  • Add CI/CD to run automatically tests

Scraper class

from this class all scrapers will inherit
Methods:

  • _chrome_driver_configuration

Save scraped data

  • Save scraped users to database (avoid creating duplicates !!! based on URL )

Scrape friends

  • Add script to scrape all friends from a given user facebook account
  • Add command to run this script

Scrape detailed data

  • Informations about
  • pronunciation of name and surname
  • Other name/surname
  • Quotes

Update project idea

  • It is not possible to scrape that amount of data in 1 session so I change the project idea to scrape only 1 person
  • Save a list of friends, Save profile and background picture, Save work, school, city, relation ship status, Email, phone etc , Photos, Groups And everything what is possible

Releas first version of the app

  • Add integraiton with sqlite
  • Create models
  • Create shemas
  • Create function to operate on db
  • Save scraped data
  • Add pytest
  • Add CI/CD
  • Add dockerfile
  • Make this repo public

Pipelines

  • Add more interaction in pipelines
  • Progress bar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.