Skip to content

Clean modules and labs-code #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def main():
result = expansions.flatten(page)
for tweet in result:
compliant_tweet_ids.append(tweet['id'])
# Here we get a difference betweetn the original
# Here we get a difference between the original
non_compliant_tweet_ids = list(set(all_tweet_ids) - set(compliant_tweet_ids))
# Here we are printing the list of Tweet IDs that are not compliant in your dataset
print(non_compliant_tweet_ids)
Expand Down
2 changes: 1 addition & 1 deletion labs-code/python/standard-product-track/compliance.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def main():
result = expansions.flatten(page)
for tweet in result:
compliant_tweet_ids.append(tweet['id'])
# Here we get a difference betweetn the original
# Here we get a difference between the original
non_compliant_tweet_ids = list(set(all_tweet_ids) - set(compliant_tweet_ids))
# Here we are printing the list of Tweet IDs that are not compliant in your dataset
print(non_compliant_tweet_ids)
Expand Down
2 changes: 1 addition & 1 deletion modules/2-choosing-the-right-product-track.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ It is ideal for undergraduate or high school students who want to use Twitter da

These are just some examples of what you can get from the standard product track, relevant to academics. For a complete list of available endpoints, check out the [Twitter API documentation](https://developer.twitter.com/en/docs/twitter-api).

Currently, you can get upto 500,000 Tweets per month using the standard product track and this limit does not apply to the sampled stream endpoint, which gives a 1% sample of public Tweets in real-time
Currently, you can get up to 500,000 Tweets per month using the standard product track and this limit does not apply to the sampled stream endpoint, which gives a 1% sample of public Tweets in real-time

## Academic Research product track

Expand Down
2 changes: 1 addition & 1 deletion modules/3-deciding-which-endpoints-to-use.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Let us look at some use cases below, to learn which endpoints can best support t

In order to get Tweets from the last 7 days, you can use the recent search endpoint and specify the keywords you want to search for. Additionally, you can use operators that let you narrow down your search (more on how to use these operators and build queries in module 5). This endpoint is available on the standard product track, so even if you don’t have access to the academic research product track, you can still get this data from the last 7 days. If you have access to the academic research product track, then you get additional operators as well as longer query length to use with this recent search endpoint.

*Fun fact:* By default, this endpoint returns 10 Tweets per request, and upto 100 Tweets per request using a max_results parameter. Thus, if you want 1000 Tweets, you will have to make 10 requests with max_results set to 100. However, many libraries and packages, including the ones we will be using for code samples in module 6, take care of making the API calls to the endpoints for you (behind the scenes) and get you the Tweets you need. Libraries and packages make it easy for you to get data from the Twitter API using functions. This reduces the amount of code you need to write in order to connect to the API and to get the API response and parse it.
*Fun fact:* By default, this endpoint returns 10 Tweets per request, and up to 100 Tweets per request using a max_results parameter. Thus, if you want 1000 Tweets, you will have to make 10 requests with max_results set to 100. However, many libraries and packages, including the ones we will be using for code samples in module 6, take care of making the API calls to the endpoints for you (behind the scenes) and get you the Tweets you need. Libraries and packages make it easy for you to get data from the Twitter API using functions. This reduces the amount of code you need to write in order to connect to the API and to get the API response and parse it.

[Learn how to get started with the recent search endpoint](https://developer.twitter.com/en/docs/twitter-api/tweets/search/introduction)

Expand Down
2 changes: 1 addition & 1 deletion modules/6a-labs-code-academic-python.md
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ def main():
result = expansions.flatten(page)
for tweet in result:
compliant_tweet_ids.append(tweet['id'])
# Here we get a difference betweetn the original
# Here we get a difference between the original
non_compliant_tweet_ids = list(set(all_tweet_ids) - set(compliant_tweet_ids))
# Here we are printing the list of Tweet IDs that are not compliant in your dataset
print(non_compliant_tweet_ids)
Expand Down
2 changes: 1 addition & 1 deletion modules/6b-labs-code-standard-python.md
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ def main():
result = expansions.flatten(page)
for tweet in result:
compliant_tweet_ids.append(tweet['id'])
# Here we get a difference betweetn the original
# Here we get a difference between the original
non_compliant_tweet_ids = list(set(all_tweet_ids) - set(compliant_tweet_ids))
# Here we are printing the list of Tweet IDs that are not compliant in your dataset
print(non_compliant_tweet_ids)
Expand Down
2 changes: 1 addition & 1 deletion modules/7-storage-and-compliance.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ If you want to process data from the filtered stream endpoint and store the Twee

When you are using the Twitter API, you should ensure that you are complying with the [Twitter developer policy](https://developer.twitter.com/en/developer-terms/policy). If you store Twitter data offline, you must keep it up to date with the current state of that content on Twitter. Specifically, you must delete or modify any content in your dataset if it is deleted or modified on Twitter.

One way academics can do this is by periodically calling the [Tweet lookup endpoint](https://developer.twitter.com/en/docs/twitter-api/tweets/lookup/introduction), with a list of Tweet IDs (upto 100 per request) from their datasets. If a Tweet has been deleted or was posted from a now- suspended or private account, the API response will indicate that and you should delete that Tweet (JSON) from your dataset. An example of this is shown in the labs in module 6 above.
One way academics can do this is by periodically calling the [Tweet lookup endpoint](https://developer.twitter.com/en/docs/twitter-api/tweets/lookup/introduction), with a list of Tweet IDs (up to 100 per request) from their datasets. If a Tweet has been deleted or was posted from a now- suspended or private account, the API response will indicate that and you should delete that Tweet (JSON) from your dataset. An example of this is shown in the labs in module 6 above.

## Sharing Tweet IDs for peer-review

Expand Down