-
- Notifications
You must be signed in to change notification settings - Fork 49.2k
Added giphy.py to fetch gifs on a given topic #5378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
633327c 6f619cb e43618a 25c9d3b 2046753 4997f35 157e0f6 c44299c 6dd357a 8eb25e7 File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,29 @@ | ||||||
| #!/bin/python | ||||||
| import random | ||||||
| import json | ||||||
| import requests | ||||||
JDeepD marked this conversation as resolved. Outdated Show resolved Hide resolved | ||||||
| | ||||||
| | ||||||
| api_key = "YOUR GIPHY API KEY" | ||||||
| # Can be fetched from https://developers.giphy.com/dashboard/ | ||||||
| | ||||||
| | ||||||
| def getgif(query: str) -> str: | ||||||
| ||||||
| """ | ||||||
| Get 1 URL of GIF on a given `query` | ||||||
| | ||||||
| ❯ python giphy.py | ||||||
| Topic: space+ship | ||||||
| Total urls received: 50 | ||||||
| https://giphy.com/gifs/startrekfleetcommand-BPVIRni1Z70QO2nJMX | ||||||
| """ | ||||||
| qu: str = '+'.join(query.split(" ")) | ||||||
| ||||||
| qu: str = '+'.join(query.split(" ")) | |
| query = '+'.join(query.split(" ")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done 👍🏻
Uh oh!
There was an error while loading. Please reload this page.