Skip to main content

Social Media Scraper

Create an instance of the PyScrappy library to interact with the class SocialMediaScraper

Helps in scraping instagram data (name, posts, followers, following, bio, captions).

1. Instagram2. Twitter3. YouTube
  • Type#


    class

  • Note#


    Create an object of this class to procced further.

  • Example#


    obj = PyScrappy.SocialMediaScrapper()

Instagram#

  • InstagramScrapper#

    Helps in scraping instagram data (name, posts, followers, following, bio, captions).

      1. Paragraph  2. Header  3. Text

    Type#


    class

    Note#


    Create an object of this class to procced further.

    Example#


    obj = PyScrappy.SocialMediaScrapper.InstagramScrapper()

    Methods#

    Here are certain in-built methods of the Instagram Scrapper. Feel free to explore them.

    1. account_scrapper()#

    Helps in scraping instagram data (name, posts, followers, following, bio, captions)

    return type#


    pandas.DataFrame (for captions)

    Parameters#


    insta_handle: Enter the desired Insta handle/username.
    Type: str

    n_pages: Enter the number of pages that you want to scrape.
    Type: int

    Note#


    Make sure the Instagram account is public, after certain number of runs, Instagram will ask you for your Instagram ID and PASSWORD, kindly enter it to continue.

    Example#


    obj = PyScrappy.SocialMediaScrapper()obj.InstagramScrapper.account_scrapper('Public_account_name', 3)

    2. hashtag_scrapper()#

    Helps in scraping instagram data (captions)

    return type#


    pandas.DataFrame (for captions)

    Parameters#


    hashtag: Enter the desired hashtag.
    Type: str

    n_posts: Enter the number of posts that you want to scrape.
    Type: int

    Note#


    After certain number of runs, Instagram will ask you for your Instagram ID and PASSWORD, kindly enter it to continue.

    Example#


    obj = PyScrappy.SocialMediaScrapper()obj.InstagramScrapper.hashtag_scrapper('Public_account_name', 3)

Twitter#

  • twitter_scrapper()#

    Helps in scraping data from Twitter ('Name', 'Twitter Handle', 'Post Time', 'Tweet', 'Reply Count', 'Retweet Count', 'Like Count').

    Return type#


    pandas.DataFrame

    Parameters#


    hashtag: Enter the desired hashtag, of which you want to scrape data of.
    Type: str

    n_pages: Enter the number of posts that you want to scrape.
    Type: int

    Note#


    Both the arguments are a compulsion. If n_pages == 0: A prompt will ask you to enter a valid page number and the scrapper will re-run.

    obj = PyScrappy.SocialMediaScrapper()obj.twitter_scrapper(hashtags, n_pages)

YouTube#

  • youtube_scrapper()#

    YouTube Scrapper: Helps in scraping YouTube data ('Title', 'Video_url', 'Views', 'Days').

    Return type#


    pandas.DataFrame

    Parameters#


    video_sec_url: Enter the desired YouTube URL (only video section)
    Type: str

    n_pages: The number of pages that it will scrape at a single run
    Type: int

    Note#


    Make sure the url is a valid YouTube url, and please enter the url ending with 'videos', i.e urls only from the video sections are acceptable. The scraping limit is unlimited.

    obj = PyScrappy.SocialMediaScrapper()obj.youtube_scrapper(video_sec_url, n_pages)