Last active
August 6, 2016 10:46
-
-
Save mr-karan/a8b525bca2587ae56981b33316e8f7aa to your computer and use it in GitHub Desktop.
script to get all asciinema urls from @coala_analyzer twitter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Quick script to download all asciinema URLs from @coala_analyzer | |
import tweepy | |
import os | |
#Twitter API credentials | |
consumer_token = os.environ['consumer_token'] | |
consumer_secret = os.environ['consumer_secret'] | |
access_token = os.environ['access_token'] | |
access_secret = os.environ['access_secret'] | |
def get_all_tweets(screen_name): | |
#Twitter only allows access to the latest 3240 tweets. | |
auth = tweepy.OAuthHandler(consumer_token, consumer_secret) | |
auth.set_access_token(access_token, access_secret) | |
api = tweepy.API(auth) | |
coala_asciinema_urls = {} | |
coala_alltweets=[] | |
#make initial request for most recent tweets (200 is the maximum allowed count) | |
new_tweets = api.user_timeline(screen_name = screen_name,count=200) | |
#save most recent tweets | |
coala_alltweets.extend(new_tweets) | |
#save the id of the oldest tweet less one | |
oldest = coala_alltweets[-1].id - 1 | |
#keep grabbing tweets until there are no tweets left to grab | |
while len(new_tweets) > 0: | |
#all subsiquent requests use the max_id param to prevent duplicates | |
new_tweets = api.user_timeline(screen_name = screen_name,count=200, | |
max_id=oldest) | |
#save most recent tweets | |
coala_alltweets.extend(new_tweets) | |
#update the id of the oldest tweet less one | |
oldest = coala_alltweets[-1].id - 1 | |
for tweets in coala_alltweets: | |
for url in tweets.entities['urls']: | |
if "asciinema" in url['expanded_url']: | |
coala_asciinema_urls[url['expanded_url']]=tweets.text | |
return coala_asciinema_urls | |
if __name__ == '__main__': | |
#pass in the username of the account you want to download | |
print(get_all_tweets("coala_analyzer")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
'https://asciinema.org/a/1g2k0la7xo5az9t8f1v5zy66q?speed=2':'Find advanced #bugs in your #java code using #coala_analyzer (via #fbinfer): https://t.co/BI6MucCVs8 - thank https://t.co/opzxFbIL38 for it!', | |
'https://asciinema.org/a/80761':'Writing #english #documentation? Check your style with the WriteGoodLintBear in #coala thanks to @karansharma1295 https://t.co/QevZAPdAUr', | |
'https://asciinema.org/a/4p1i873ebi9qdfmczn2tvxrm0':'Did you know: #coala is always written with a lower case c! Always! Now you can enforce it on your project: https://t.co/t6e9xB532s', | |
'https://asciinema.org/a/46834?autoplay=true':'Thanks to @karansharma1295 #coala can check #golang code for unchecked errors: https://t.co/hkh32GzkRZ', | |
'https://asciinema.org/a/42945?speed=2':'New #coala_analyzer demo #asciinema available: https://t.co/tWycNAlcvt', | |
'https://asciinema.org/a/45061':'#coala gets a better bear listing: https://t.co/La5gaOI1KL its up for review on #GitHub. Any feedback or suggestions?', | |
'https://asciinema.org/a/0y0oxtak18v492jdyfqwpw1n4':'Good news for #RLang - turn and tweak the RFormatBear as deep as you like thanks to @SobAsnel : https://t.co/a31IzdobvO', | |
'https://asciinema.org/a/3gxhsunm4cap876j2bdrkw705':'Use #coala_analyzer right in #vim thanks to https://t.co/JnuPg9HMgf! https://t.co/tAA7FbpNGV (#ASCIInema! https://t.co/hNkT0ZRo2O)', | |
'https://asciinema.org/a/e146c9739ojhr8396wedsvf0d':'Check #git commit messages for the right tense using #coala_analyzer now: https://t.co/Y1y5HP47sy (avail. in dev release)', | |
'https://asciinema.org/a/42968?autoplay=1':'New typo-free video available on https://t.co/QETWA3K2ep thanks to https://t.co/RyfZq5QOiy - find issues? Fix on https://t.co/bLl2UGOu2p!', | |
'https://asciinema.org/a/38595':'Let #coala_analyzer autocorrect your #Rlang code thanks to @karansharma1295 and formatR! https://t.co/Xmrm8jHr3I', | |
'https://asciinema.org/a/80714':'To see more about the Happiness Bear check this out! https://t.co/1zkJ7DzXDS', | |
'https://asciinema.org/a/43062?autoplay=1&speed=1.5':'Struggling telling coala what to analyze? New debug feature available thanks to @ATovt that shows collected files: https://t.co/LgSAXrAyB6', | |
'https://asciinema.org/a/7z8ol9mpsgtuo1096c6jk8hi6':'Check for nasty #security related problems in #C with #coala thanks to @SobAsnel : https://t.co/1yzDaYthSb', | |
'https://asciinema.org/a/39250?speed=2':'Find complicated #JS functions with #coala_analyzer right now thanks to @arafsheikh - https://t.co/4E01kA40M4', | |
'https://asciinema.org/a/38739':'Thanks to @sudheesh001 #coala_analyzer can now autocorrect issues with your #js code: https://t.co/PzB34HlK3i #javascript #lint', | |
'https://asciinema.org/a/45275':"@ico_TC how's that: https://t.co/0R8G7SCgee", | |
'https://asciinema.org/a/40055':'Thanks to @karansharma1295 and #gotype we got advanced syntactic and semantic #lint ing of #go files: https://t.co/WdrT1JMSPP #golang', | |
'https://asciinema.org/a/9re9c4fv17lhn7rmvzueebb3b?speed=2':'#JS and #JSX are not enough: #coala_analyzer supports analyzing #TypeScript thanks to @arafsheikh. https://t.co/wlPZGPj3CI', | |
'https://asciinema.org/a/45666?autoplay=True':'#coala supports analyzing #apple #swift code thanks to @arafsheikh : https://t.co/dYjl4mZVEZ #swiftlang', | |
'https://asciinema.org/a/39241':'Advanced #ruby #lint ing comes to #coala_analyzer thanks to #RuboCop and @karansharma1295: https://t.co/pHu1nzrXcc', | |
'https://asciinema.org/a/40093':'Automatically add vendor prefixes to your #css with @coala_analyzer thanks to @karansharma1295: https://t.co/DfEI7mv6Dr' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment