updatename.py
· 517 B · Python
Raw
#!/usr/bin/env python
import tweepy
import json
import random
with open(".twitter_config.json") as f:
# a json file containing {"ckey": "", "csec": "", "utok": "", "usec": ""}
config = json.load(f)
auth = tweepy.OAuthHandler(config["ckey"], config["csec"])
auth.set_access_token(config["utok"], config["usec"])
api = tweepy.API(auth)
with open("emoji.dat") as f:
# generated using the other snippet below
d = [i.encode('utf-8') for i in json.load(f)]
api.update_profile("Steven Smith " + random.choice(d))
| 1 | #!/usr/bin/env python |
| 2 | import tweepy |
| 3 | import json |
| 4 | import random |
| 5 | |
| 6 | with open(".twitter_config.json") as f: |
| 7 | # a json file containing {"ckey": "", "csec": "", "utok": "", "usec": ""} |
| 8 | config = json.load(f) |
| 9 | |
| 10 | auth = tweepy.OAuthHandler(config["ckey"], config["csec"]) |
| 11 | auth.set_access_token(config["utok"], config["usec"]) |
| 12 | api = tweepy.API(auth) |
| 13 | |
| 14 | with open("emoji.dat") as f: |
| 15 | # generated using the other snippet below |
| 16 | d = [i.encode('utf-8') for i in json.load(f)] |
| 17 | |
| 18 | api.update_profile("Steven Smith " + random.choice(d)) |
zemojigen.py
· 367 B · Python
Raw
#!/usr/bin/env python
from requests import get
from bs4 import BeautifulSoup as Soup
soup = Soup(get("http://apps.timwhitlock.info/emoji/tables/unicode").text)
emojis = [str(a.text).decode("string_escape") for a in soup.findAll("td", {"class": "code"})[1::2]]
o = [_ for _ in emojis if len(_) == 4]
from json import dump
with open("emoji.dat", "w") as f:
dump(o, f)
| 1 | #!/usr/bin/env python |
| 2 | from requests import get |
| 3 | from bs4 import BeautifulSoup as Soup |
| 4 | soup = Soup(get("http://apps.timwhitlock.info/emoji/tables/unicode").text) |
| 5 | emojis = [str(a.text).decode("string_escape") for a in soup.findAll("td", {"class": "code"})[1::2]] |
| 6 | o = [_ for _ in emojis if len(_) == 4] |
| 7 | from json import dump |
| 8 | with open("emoji.dat", "w") as f: |
| 9 | dump(o, f) |