Skip to content

Instantly share code, notes, and snippets.

View tantofish's full-sized avatar

Yu Tu tantofish

View GitHub Profile
@tantofish
tantofish / qq.py
Last active January 6, 2017 03:10
Sample of reading ajax response of twitter timeline next scroll
>>> import json
>>> data_file = open('/Users/yutu/Desktop/json')
>>> data = json.load(data_file)
>>> parsed_data = BeautifulSoup(data.get('items_html'),"html.parser")
>>> tweets_html = src.findAll('p',attrs={'class':'tweet-text'})
>>> tweets_text = [x.getText() for x in tweets_html]
>>> for tweet in tweets_text:
... tweet
...
'This #E3 is probably already giving me more things to be excited about than the last two combined.'

Obtain an oAuth token

Twitter requires every requests with oAuth token. Register one at here: https://apps.twitter.com/

Then you will have the following tokens:

  • consumer_key
  • consumer_secret
  • access_token
  • access_token_secret
@tantofish
tantofish / CreatePR.md
Created April 26, 2016 03:32
Create git PR from command line
  1. Install jq
  2. Create git remote access token
  3. Add token to .gitconfig
[user]
   email = xxx
   user = xxx
   token = xxxxxxxxxx