specrom

specrom / Scrape_Tweets_From_Twitter / 0.1.0

Scrape_Tweets_From_Twitter

50 Credit Royalty
Scrape tweets from twitter by either specifying a username or search query
Language
Python 3.x
Metrics
API Calls - 14 Avg call duration - 1.79sec
Permissions
The Algorithm Platform License is the set of terms that are stated in the Software License section of the Algorithmia Application Developer and API License Agreement. It is intended to allow users to reserve as many rights as possible without limiting Algorithmia's ability to run it as a service. Learn More
This is necessary for algorithms that rely on external services, however it also implies that this algorithm is able to send your input data outside of the Algorithmia platform.
This allows an algorithm to compose sophisticated functionality using other algorithms as building blocks , however it also carries the potential of incurring additional royalty and usage costs from any algorithm that it calls .

Run an Example

Input
Output
[
  {
    "date": "2020-08-12 13:30:11+00:00",
    "favorites": 128,
    "geo": "",
    "mentions": "",
    "permalink": "https://twitter.com/WSJ/status/1293540286375825410",
    "retweet_no": 60,
    "tweet_text": "The Trump administration is preparing anticorruption sanctions against Hezbollah’s allies in Lebanon, as it seeks to weaken the group in the aftermath of the Beirut explosion",
    "username": "WSJ"
  },
  {
    "date": "2020-08-12 13:15:07+00:00",
    "favorites": 197,
    "geo": "",
    "mentions": "",
    "permalink": "https://twitter.com/WSJ/status/1293536493131182081",
    "retweet_no": 40,
    "tweet_text": "Kamala Harris has spent her career courting competing constituencies, drawing criticism along the way. Now that balancing act may play to her advantage.",
    "username": "WSJ"
  },
  {
    "date": "2020-08-12 12:45:07+00:00",
    "favorites": 160,
    "geo": "",
    "mentions": "",
    "permalink": "https://twitter.com/WSJ/status/1293528942138273792",
    "retweet_no": 119,
    "tweet_text": "TikTok tracked user data for at least 15 months by sidestepping a privacy safeguard in Google’s Android operating system, WSJ testing found",
    "username": "WSJ"
  },
  {
    "date": "2020-08-12 12:20:35+00:00",
    "favorites": 260,
    "geo": "",
    "mentions": "",
    "permalink": "https://twitter.com/WSJ/status/1293522769234321408",
    "retweet_no": 162,
    "tweet_text": "Media mogul Sumner Redstone, who built a global empire spanning television, movies and books and famously proclaimed that “content is king,” has died at 97",
    "username": "WSJ"
  },
  {
    "date": "2020-08-12 11:30:13+00:00",
    "favorites": 605,
    "geo": "",
    "mentions": "",
    "permalink": "https://twitter.com/WSJ/status/1293510093145866241",
    "retweet_no": 114,
    "tweet_text": "Kamala Harris is the first Black woman and first woman of Indian descent on a major party U.S. presidential ticket",
    "username": "WSJ"
  },
  {
    "date": "2020-08-12 11:00:01+00:00",
    "favorites": 324,
    "geo": "",
    "mentions": "",
    "permalink": "https://twitter.com/WSJ/status/1293502493071089670",
    "retweet_no": 104,
    "tweet_text": "Kamala Harris and Joe Biden are due to make their first appearance together as running mates today. The California senator is the first Black woman and woman of Asian descent on a major party ticket. #WSJWhatsNow",
    "username": "WSJ"
  },
  {
    "date": "2020-08-12 09:45:06+00:00",
    "favorites": 103,
    "geo": "",
    "mentions": "",
    "permalink": "https://twitter.com/WSJ/status/1293483643218919425",
    "retweet_no": 68,
    "tweet_text": "Chinese President Xi Jinping’s new development model, translated as “domestic circulation,” is meant to make China far less dependent on foreign firms, technology and markets",
    "username": "WSJ"
  },
  {
    "date": "2020-08-12 08:00:08+00:00",
    "favorites": 138,
    "geo": "",
    "mentions": "",
    "permalink": "https://twitter.com/WSJ/status/1293457225910976513",
    "retweet_no": 58,
    "tweet_text": "The former head of Mexico’s state-oil company accused former president Enrique Peña Nieto and his former finance minister of instructing him to funnel bribes to the 2012 presidential campaign",
    "username": "WSJ"
  },
  {
    "date": "2020-08-12 06:37:30+00:00",
    "favorites": 129,
    "geo": "",
    "mentions": "",
    "permalink": "https://twitter.com/WSJ/status/1293436432023945216",
    "retweet_no": 97,
    "tweet_text": "The U.K. economy shrank 20.4% in the second quarter, equivalent to an annualized rate of 59.8%",
    "username": "WSJ"
  },
  {
    "date": "2020-08-12 05:00:13+00:00",
    "favorites": 1623,
    "geo": "",
    "mentions": "",
    "permalink": "https://twitter.com/WSJ/status/1293411948558725120",
    "retweet_no": 1468,
    "tweet_text": "TikTok skirted a privacy safeguard in Google’s Android operating system to collect unique identifiers from millions of mobile devices, data that allows the app to track users online without allowing them to opt out, a WSJ analysis has found https://on.wsj.com/3kyBLaF",
    "username": "WSJ"
  }
]

Install and Use

Install

Install the Algorithmia CLI client by running:

curl -sSLf https://algorithmia.com/install.sh | sh

Then authenticate by running:

$ algo auth
# When prompted for api endpoint, hit enter
# When prompted for API key, enter your key: YOUR_API_KEY
CLI Install Docs

Use



    algo run specrom/Scrape_Tweets_From_Twitter/0.1.0 -d '{"q":"", "no_of_tweets":"10", "username":"wsj", "start_date":"2020-01-01", "end_date":"2020-08-20"}' --timeout 300
  
CLI Docs