Your SlideShare is downloading. ×
0
Regex, Python & Twitter
Regex, Python & Twitter
Regex, Python & Twitter
Regex, Python & Twitter
Regex, Python & Twitter
Regex, Python & Twitter
Regex, Python & Twitter
Regex, Python & Twitter
Regex, Python & Twitter
Regex, Python & Twitter
Regex, Python & Twitter
Regex, Python & Twitter
Regex, Python & Twitter
Regex, Python & Twitter
Regex, Python & Twitter
Regex, Python & Twitter
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Regex, Python & Twitter

1,966

Published on

Using regular expressions and python to search twitter like a boss

Using regular expressions and python to search twitter like a boss

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,966
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
15
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Transcript

    • 1. webdesigner
    • 2. Picture by Okinawa Soba
    • 3. WHAT is REGEX Regular Expressions A special text string that describes a search pattern
    • 4. EXAMPLES Find email address (?:[a-z0-9!#$%&*+/=?^_`{|}~-]+(?:.[a-z0-9!#$%&*+/=?^_` {|}~-]+)*|"(?:[x01-x08x0bx0cx0e-x1fx21x23-x5b x5d-x7f]|[x01-x09x0bx0cx0e-x7f])*")@(?:(?:[a- z0-9](?:[a-z0-9-]*[a-z0-9])?.)+[a-z0-9](?:[a-z0-9-]*[a- z0-9])?|[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).) {3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a- z0-9]:(?:[x01-x08x0bx0cx0e-x1fx21-x5ax53-x7f]| [x01-x09x0bx0cx0e-x7f])+)]) ✔ The Official Standard: RFC 2822
    • 5. EXAMPLES Find email address easier w[w._]+@[w.]+[.]w+{2,4}
    • 6. EXAMPLES Find email address easier “My email address is: stelian@firez.be” w[w._]+@[w.]+[.]w+{2,4} “My email address is: stelian@firez.be” w[w._]+@[w.]+[.]w+{2,4} “My email address is: stelian@firez.be” w[w._]+@[w.]+[.]w+{2,4} “My email address is: stelian@firez.be”
    • 7. EXAMPLES Find email address easier “My email address is: stelian@firez.be” w[w._]+@[w.]+[.]w+{2,4} “My email address is: stelian@firez.be” w[w._]+@[w.]+[.]w+{2,4} “My email address is: stelian@firez.be” w[w._]+@[w.]+[.]w+{2,4} “My email address is: stelian@firez.be”
    • 8. WHAT is PYTHON Life is short, use Python
    • 9. WHO uses PYTHON Google Blender 3D Civilization 4
    • 10. WHY PYTHON Lots of modules Easy to read syntax API wrappers Great community
    • 11. PYTHON does click picture to open video
    • 12. SEARCH TWITTERAPI limitations 150 anonymous calls per hour 350 authenticated calls per hour results from only the past 7 days max 1500 results
    • 13. SEARCH TWITTERRequirements minimum Python knowledge Twitter API wrapper (twython)
    • 14. EXAMPLES Designers in Antwerpen 1 from twython import Twython 2 twitter = Twython() 3 search_results = twitter.searchTwitter(q="design", since_id=0, rpp=100, geocode="51.21992,4.39625,10km", page=1) 4 5 for tweet in search_results[results]): 6 print tweet[‘id’] 7 print tweet[‘created_at’] 8 print tweet[‘from_user’] 9 print tweet[‘profile_image_url’] 10 print tweet[‘text’]
    • 15. EXAMPLES Designers in Antwerpen 1 from twython import Twython 2 twitter = Twython() 3 user_info = twitter.getUserTimeline(id=tweet[from_user]) [0][user] 4 print user_info[name] 5 print user_info[time_zone] 6 print user_info[location] 7 print user_info[description] 8 print user_info[url]
    • 16. http://regular-expressions.infoSams Teach Yourself Regular Expressions in 10 Minutes Python v2.6.6 documentation Twython - Python wrapper for the Twitter API Twitter Search API

    ×