Git Product home page Git Product logo

twi's Introduction

Twisearch

Added functionality to get profile information for a twitter user, and to get the first post for a list of hashtags.

Install

  1. For dependencies:
python -m pip install selenium bs4 datetime
  1. Download the chromedriver from here
  2. Open the file twisearch.py and set the variable EXECUTABLE_PATH to the path where the driver is downloaded.

Twitter Search

Code

from twisearch import twitterSearch

results = twitterSearch("Pakistan News")
print(results)

Ouput

[{'id': '18140095',
  'username': 'paknews',
  'name': 'Pakistan News',
  'media_directory': 'https://pbs.twimg.com/profile_images/1737791275/Flag-of-Pakistan-256_bigger.png'},
 {'id': '54246210',
  'username': 'NewsInsider',
  'name': 'Latest Pakistan News',
  'media_directory': 'https://pbs.twimg.com/profile_images/303756524/images_bigger.jpeg'},
 {'id': '480682661',
  'username': 'PakistanWeekly',
  'name': 'Pakistan Weekly News',
  'media_directory': 'https://pbs.twimg.com/profile_images/2341730932/8l4e9321u5tzme9a333s_bigger.jpeg'}]

Twitter User Profile Info

Code

from twiuser import twitter_profile

results = twitterSearch("reddit")
print(results)

Ouput

{'id': '811377',
 'profile_image_url': 'https://pbs.twimg.com/profile_images/1267872080797696002/5hv6hTuL_400x400.jpg',
 'Full_name': 'Reddit',
 'bio_data': 'The front page of the internet  •  Get the app: http://reddit.com/mobile/download\xa0 • Interested in doing an AMA? Visit http://redditinc.com/ama\xa0',
 'location': 'San Francisco, CA',
 'website': 'http://reddit.com',
 'join_date': 'Joined March 2007',
 'Tweets': '77,394 Tweets',
 'Following': '558 Following',
 'Followers': '712,742 Followers',
 'Likes': '10,706 Likes',
 'Lists': '',
 'moments': '1 Moment'}

Twitter Hashtag Originator

Code

from hashtag_originator import twi_hashtag_originator

result = twi_hashtag_originator("pia planecrash")
print(result)

Output

{'poster': {'full_name': '*Muhammad Uzair*', 'username': 'MadaniMsgs', 'url': 'https://www.twitter.com/MadaniMsgs', 'id': '', 'profile_image_url': 'https://pbs.twimg.com/profile_images/3247532514/06228b921421d7155ade3467ed6ebb52_bigger.jpeg'},
'timestamp': '2012-04-21T00:53:25.000Z',
'post_link': 'https://www.twitter.com/MadaniMsgs/status/193502667727835136',
'post_text': '#PIA   operating special flight today 7 am for immediate  #family  members of  #BhojaAir  affectees.  http://    #planecrash    #bhojaair',
'embed': '<blockquote class="twitter-tweet"><a href="https://www.twitter.com/MadaniMsgs/status/193502667727835136"></a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>',
'screenshot': '/home/sascs/sacas/data/twitter/pia_planecrash'}

twi's People

Contributors

saadejazz avatar

Watchers

 avatar

Forkers

gamercode

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.