I detected the release on Twitter before the notification of my script came, and I ended up tweeting manually as usual. I tried running both my method and haminiku's method, but neither of them came to detect the release. Sorry ...
(It's not that it can't be detected completely, and now that it's ranked high in the search, it's gotcha firmly.)
Looking at Twitter, it feels like it's about to be released in Japan, and various information is complicated and I have to search the App Store every time and repeat things that I do not want to do, which makes me angry. I was wondering if I could notify with a script.
Postscript: This article If released, link to my Twitter account (@touyoubuntu) I try to tweet. By all means! (Currently, I'm drinking sweat in the darkness of pyenv) β Completed!
It took a while for the application to take effect, so it was difficult to check the test tweets, but it seems to be okay. Specifically, the following function is called at Gotcha below.
tweet.py
def tweet():
twitter = OAuth1Session(CONSUMER_KEY, client_secret=CONSUMER_SECRET, resource_owner_key=ACCESS_TOKEN, resource_owner_secret=ACCESS_TOKEN_SECRET)
params = {"status": "It seems that Pokemon Go has finally been released in Japan! http://itunes.apple.com/jp/app/pokemon-go/id1094591345?mt=8"}
req = twitter.post("https://api.twitter.com/1.1/statuses/update.json", params=params)
print req.status_code
Basically, iTunes Search API is used. I know that the developer is Niantic, Inc., so I copied the sellerName of Ingress and used it.
I search pokemon go once every 30 seconds (I'm scared because I haven't read the terms well) and look for Niantic, Inc. products in it.
pokemon_go_alert.py
import urllib
import urllib2
import json
import time
url = 'https://itunes.apple.com/search?term=pokemon+go&country=jp&media=software&entity=software&lang=ja_jp'
def func():
while True:
try:
r = urllib2.urlopen(url)
root = json.loads(r.read())
for data in root['results']:
if u'Niantic, Inc.' in data[u'sellerName']:
print "Gotcha!"
tweet()
return
print "has not been released yet in Japan"
finally:
r.close()
time.sleep(30.0)
func()
I didn't make it the main
method. This will terminate the script if it displays has not been released yet or Gotcha! Every 30 seconds.
If you change this Gotcha part to tweet on Twitter and make the interval a little shorter, the fastest detection of Pokemon Go release is not a dream.
I wrote Python for the first time in a while. I think it was regrettable that there was no sellerUrl, which is said to be found in the iTunes API, in terms of improving accuracy.
Feel free to comment if you have any problems or suggestions for further improvements.
I wonder if Pokemon Go is still ...
-Summary of how to use iTunes API -Get and parse json with python urllib2 -Create a delay-like waiting time with python -I was worried about Python's judgment of "whether the character string contains XX"
There was a person doing the same thing by embedding the process of making a call lol [Stada] Script that will call you when Pokemon GO is released
People who let Slack be notified in Ruby Searching for Pokemon Go on iTunes is too painful, so I prepared crontab
It's really interesting that everyone makes articles at the same time lol