url = 'https://twitter.com/i/realDonaldTrump/conversation/935340092583006208?include_available_features=1&include_entities=1&max_position=&reset_error_state=false'
res = requests.get(url)
res.json()
items = PyQuery(res.json()['items_html'])('ol.stream-items')
for item in items:
print item
https://twitter.com/i/activity/retweeted_popup?id=912741016947609600
https://twitter.com/i/activity/favorited_popup?id=912741016947609600
fetch_activities(912741016947609600)
tweet.__dict__
tweetCriteria = got.manager.TweetCriteria().setQuerySearch('ack linux').setTweetType('f=news').setMaxTweets(40)
tweets = got.manager.TweetManager.getTweets(tweetCriteria)
len(tweets)
for i in tweets:
print i.__dict__
ancestor
has-replies
original-permalink-page
descendant permalink-descendant-tweet
tweetPQ('p.js-tweet-text a').filter(lambda i: PyQuery(this).attr('data-expanded-url') != None)
html = requests.get('https://twitter.com/GailDavvis/status/935342611065339907',headers=headers)
doc = PyQuery(html.content)
tweetPQ = PyQuery(doc)
def fetch_entities(tweetPQ):
hashtags = []
urls = []
for url in tweetPQ('p.js-tweet-text a'):
d = dict(url.items())
if d['class'] == 'twitter-timeline-link':
urls.append({'href':d['href'],'expanded_url':d['data-expanded-url']})
if d['href'].startswith('/hashtag/'):
hashtags.append(d['href'].split('?')[0].split('/')[-1])
tweetPQ('p.js-tweet-text a.twitter-timeline-link').remove()
return hashtags,urls
tweetPQ('p.js-tweet-text a')
fetch_entities(tweetPQ)
tweetPQ('p.js-tweet-text a')