0% found this document useful (0 votes)
12 views21 pages

Social Networking

The document provides step-by-step instructions for creating and exploring APIs for Twitter, Facebook, and GitHub, including generating access tokens and using Python for data analysis. It also outlines procedures for analyzing social graphs and querying human language data using TF-IDF. Each section includes specific commands and expected outputs for successful implementation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views21 pages

Social Networking

The document provides step-by-step instructions for creating and exploring APIs for Twitter, Facebook, and GitHub, including generating access tokens and using Python for data analysis. It also outlines procedures for analyzing social graphs and querying human language data using TF-IDF. Each section includes specific commands and expected outputs for successful implementation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 21

SOCIAL NETWORKING

1. CREATING AND EXPLORING TWITTER’S API


Step 1: Create a Twitter account and login to Twitter developer portal
using the link below

https://developer.twitter.com/en/portal/dashboard
Step 2: Navigate to Projects & Apps->Overview .

Step 3: Click on the settings symbol and navigate to User authentication settings
and Edit.
Step 4: Enable Read and write and Direct message

Step 5: Enable to type of app 🡪 and choose Native App.


Step 6: Enter any URL in Callback URI / Redirect URL and Website
URL.

Step 7 : Proceed with Step 2 and Click on the regenerate key symbol to
get API Key and Secret and Access Token and Secret.

Step 8: Regenerate Key from Developer portal and use in program.


Step 9: Install python package using command
pip install requests and pip install requests-oauthlib on command
prompt.

Step 10: Run the program in any IDE.(Spyder, Colab etc)

Step 11: To create a post enter the post id. Refresh the page and check
the tweet is created check the tweet is created.

Step 12: To delete a post enter the post id. Refresh the page and check
the tweet is deleted.
Step 13: To exit the program enter the post id. Refresh the page and
program is exited.

2. CREATING AND EXPLORING FACEBOOK’S SOCIAL GRAPH


API
Step 1: Open the Facebook Developer by using any browser.

Step 2: Login into the Facebook Developer.


Step 3: In Meta Facebook Developer Menu, Select My apps -
>Choose Tools and - >Select Graph API Explorer.

Step 4: Click the Generate Access Token.


Step 5: Write the source code in any python supporting
platform like Spyder. And install needed packages

Step 6: To get user id select your fb profile -> click on settings ->
select settings & privacy -> select apps and websites from the
drop down list which appears on the left -> choose your apps
‘view and edit’ ->under name and profile you can find your user id

Step 7: update your user id

Step 8: Copy and Paste theGenerated Access Token as the


value for access token variable in the source code.
Step 9: Paste the Access Token key

Step 10: Run the Source Code.

OUTPUT:

3.TO ANALYZING THE FACEBOOK’S SOCIAL GRAPH


CONNECTIONS.
PROCEDURE:
Step 1: Open the Facebook Developer by using any browser.
Step 2: Login into the Facebook Developer.

Step 3: In Meta Facebook Developer Menu, Select My apps -


>Choose Tools and ->Select Graph API Explorer.

Step 4: In the user or page drop down list select the API Test
Page.
Step 5: Copy and Paste the Generated Access Token as the
value for access token variable in the source code.

Step 6: Select the API Test Page option in the Your Pages and
Profiles menu.

Step 7: Run the Source Code.


OUTPUT:

4.TO CREATE AND QUERYING HUMAN LANGUAGE DATA


WITH TF-IDF

PROCEDURE:
STEP 1: Import required libraries such as
sklearn.feature_extraction.text
for TfidfVectorizer, and pandas for DataFrame.

STEP 2: Define the text for each document (document_Speech_1,


document_Speech_2) containing the text you want to analyze.
STEP 3: Create a list called corpus containing all the document texts.

STEP 4: Initialize a Tfidf Vectorizer object named vectorizer and Use


the
fit_transform() method of the vectorizer object. This step
computes the TF-IDF values for each term in the corpus.

STEP 5: The method 'get_feature_names_out()' of the vectorizer object


which will provide the names of the terms in the TF-IDF matrix.

STEP 6: Create a DataFrame df using pd.DataFrame.sparse.from_


spmatrix() function and print the first few rows of the DataFrame
using head() method to display the initial content of the DataFrame.

STEP 7: This will display the TF-IDF matrix in tabular form with terms
as columns and documents as rows, where each cell represents the TF-
IDF value of the corresponding term in the respective document.

OUTPUT:
car driven highway road truck
0 0.631667 0.449436 0.000000 0.631667 0.000000
1 0.000000 0.449436 0.631667 0.000000 0.631667

5.CREATE AND EXPLORE GITHUB’S API


PROCEDURE:
Step 1: Open Github by using any browser.
Step 2: Login into the Github.

Step 3: Click the profile in the right side corner.


Step 4: Copy the username and paste it in the source code.

Step 5: Next go to the settings in the profile then scroll down.

Step 6: Click Developer Settings and then click Personal access


token.
Step 7: In that click Tokens(Classic) and then click Generate a
personal access token.

Step 8: Type anything in note and then tick repo Checkbox.

Step 9: Then Click Generate Token and after copy that


generated token and paste it in
the program.
OUTPUT:
User: YuvaaSankar
Name: None
Followers: 0
Public Repositories: 2
6.TO ANALYZING GITHUB’S INTEREST GRAPH

PROCEDURE:

Step 1: Open Github by using any browser.

Step 2: Login into the Github.


Step 3: Click Your Repositories 🡪 click New.

Step 4: Type any name in repository name and select public


option and click create
Repository.

Step 5: Click the profile in the right side corner 🡪 choose Settings
Step 6: Now choose developer settings🡪 generate personal
access token

Step 7: Then go to your repositories in the profile.


.

Step 8:Click the star icon of the repositories

Step 9: Run the program.


OUTPUT:

You might also like