In December 2022 Elon made the number of times a tweet has been seen publicly available information. Is there a way to include getting view count on scraped tweets? I have been using Python and SnScrape to pull tweets, but have not been able to get view counts for these pulled tweets
###Pulling tweets with SNScrape###
!pip install -q snscrape==0.3.4
###Pulling just 1 tweet to test it###
searchterm = '###query search term here###'
scraper= sntwitter.TwitterSearchScraper(searchterm)
for tweet in scraper.get_items():
break
###Looking at the result###
tweet
Related
A few days ago, I applied a twitter developer account to be used with tweepy library. I tried to scrape with keyword like Google, get a lot of tweets. But after I tried to scrape data with specific keyword, I only got 1 tweet, even though tweets related to those keyword were pretty much on Twitter.
tweets = tw.Cursor(api.search,
q='simas jiwa',
lang="id",
since=datetime.date(2005, 10, 6)).items(100)
The result is like this:
#SimasJiwa asuransi simas jiwa aman2 saja kan ?
How to solve this problem? Why only get 1 tweet?
There’s a option you can add to the Cursor. Max amount without a license is 100 though
Count=x
How do I scrape historical tweet from twitter with their location inclusive
I was able to get tweets with their location using the tweeter API, but it doesn't go beyond a certain period. How do I get historical tweets with their location inclusive using a hashtag.
I saw this code from github which I could get historical tweets but I've been unable to modify it to get the location of the tweets.Also how do I get the parameters passed into the xpath and css methods. How do I modify the code to get the location of my tweets historical.
the tweet crawler I'm using is from : https://github.com/jonbakerfish/TweetScraper/blob/master/TweetScraper/spiders/TweetCrawler.py
Advice on any other way I have use to get it will be apprecaited
# Initiate the connection to Twitter
twitter = Twitter(auth=oauth)
# Search for latest tweets about "pakistan"
results = twitter.search.tweets(q='pakistan',until=2008 - 08 - 19, )
print results
I am trying to retrieve tweets that are earlier than this date by one week. It does not return anything. However, I have searched manually on twitter and found that tweets exist.
When you use the Twitter API to download tweets you will have access to tweets back to roughly one week old. This is despite the fact that you can see tweets older than one week on Twitter's website. This is a built-in limitation of the API.
To have access to a bigger time span you can do the following ways:
download everyday data and add up gradually.
you can search on the web to find a dataset
The best way is to ask Twitter to give you the data for a specific time span while you have an API developer account. You have asked for a quote using this address:
https://www.trackmyhashtag.com/twitter-dataset#request-data-form
Im trying to get all of a user's tweets for a 2 month time period. In search I see results but this code returns an empty array. Why?
results = api.GetSearch(raw_query="q=&from=yikyakapp&since=2014-09-24&until=2014-11-24")
print(results)
This is because Twitter search API has a limit of 7 days. Check the API documentation
The Twitter Search API searches against a sampling of recent Tweets published in the past 7 days.
There is a detailed explanation here https://dev.twitter.com/rest/reference/get/search/tweets
Keep in mind that the search index has a 7-day limit. In other words,
no tweets will be found for a date older than one week.
In summary, you can't use Twitter API to search for tweets beyond 7 days. Of course, in the website they can show you whatever they want. They hold all the data.
I need to scrape the exact number of tweets that are generated under certain Twitter accounts on a daily basis. As well as the number of followers.
As far as I know Twitter's streaming API is not complete.
Does anyone know a suitable source - not necessarily from Twitter. I am already scraping from Topsy but I could not figure out yet how to limit the displayed tweets to only a single account. I do not even need the content but only the number of generated tweets and the number of followers.
Thank you!!!
There are several python modules that can be used.
Here is how you could go about getting a list of followers with Twython
(from: How to get twitter followers using Twython?)
from twython import Twython
twitter = Twython()
followers = twitter.get_followers_ids(screen_name = "ryanmcgrath")
for follower_id in followers:
print "User with ID %d is following ryanmcgrath" % follower_id