goris is a CLI tool to search for images with Google Reverse Image Search.
Today, it was updated to v3.0.1. Please check it out. https://github.com/tanaikech/goris
-
v3.0.1 (May 2, 2022)
- About the option
-w, a bug was resolved. By this, the URLs of the related Web site are returned. As the default, 10 URLs are returned. If you want to retrieve more, please use the option -n like -n 20.
goris is a CLI tool to search for images with Google Reverse Image Search.
Today, it was updated to v3.0.0. Please check it out. https://github.com/tanaikech/goris
goris is a CLI tool to search for images with Google Reverse Image Search.
Today, it was updated to v2.0.0. Please check it out. https://github.com/tanaikech/goris
-
v2.0.0 (April 23, 2020)
- The specification for running the reverse image search was changed at Google side. By this, this application was also changed.
goris is a CLI tool to search for images with Google Reverse Image Search.
Today, it was updated to v1.1.0. Please check it out. https://github.com/tanaikech/goris
When images are matched to a searched image, web pages with matching images are retrieved. These are web pages displayed on Google top page. When this is not used, images are retrieved. This was added as a boolean option. (This was added by a request.)
goris is a CLI tool to search for images with Google Reverse Image Search.
Today, it was updated to v1.0.1. Please check it out. https://github.com/tanaikech/goris
When number of retrieved URLs is smaller than number of default output, an error had occurred. This was fixed.
gogauth is a CLI tool to easily retrieve access token for using APIs on Google.
I thought that if the access token can easily retrieve, it may be useful for users who can use various convenience Google APIs. So I created this. Also this can be used for testing sample script like the demo. If this will be helpful for you, I’m glad.
Today, it was updated to v2.0.1. Please check it out. https://github.com/tanaikech/gogauth
This is a sample script for OCR using Google Drive API. A text file which converted by OCR can be retrieved by inputting an image file.
In this sample, Python Quickstart is used. The detail information is https://developers.google.com/drive/v3/web/quickstart/python. Please read “Step 1: Turn on the Drive API” and “Step 2: Install the Google Client Library”.
from __future__ import print_function
import httplib2
import os
import io
from apiclient import discovery
from oauth2client import client
from oauth2client import tools
from oauth2client.file import Storage
from apiclient.http import MediaFileUpload, MediaIoBaseDownload
try:
import argparse
flags = argparse.ArgumentParser(parents=[tools.argparser]).parse_args()
except ImportError:
flags = None
# If modifying these scopes, delete your previously saved credentials
# at ~/.credentials/drive-python-quickstart.json
SCOPES = 'https://www.googleapis.com/auth/drive'
CLIENT_SECRET_FILE = 'client_secret.json'
APPLICATION_NAME = 'Drive API Python Quickstart'
def get_credentials():
"""Gets valid user credentials from storage.
If nothing has been stored, or if the stored credentials are invalid,
the OAuth2 flow is completed to obtain the new credentials.
Returns:
Credentials, the obtained credential.
"""
credential_path = os.path.join("./", 'drive-python-quickstart.json')
store = Storage(credential_path)
credentials = store.get()
if not credentials or credentials.invalid:
flow = client.flow_from_clientsecrets(CLIENT_SECRET_FILE, SCOPES)
flow.user_agent = APPLICATION_NAME
if flags:
credentials = tools.run_flow(flow, store, flags)
else: # Needed only for compatibility with Python 2.6
credentials = tools.run(flow, store)
print('Storing credentials to ' + credential_path)
return credentials
def main():
credentials = get_credentials()
http = credentials.authorize(httplib2.Http())
service = discovery.build('drive', 'v3', http=http)
imgfile = 'sample.png' # Image with texts (png, jpg, bmp, gif, pdf)
txtfile = 'output.txt' # Text file outputted by OCR
mime = 'application/vnd.google-apps.document'
res = service.files().create(
body={
'name': imgfile,
'mimeType': mime
},
media_body=MediaFileUpload(imgfile, mimetype=mime, resumable=True)
).execute()
downloader = MediaIoBaseDownload(
io.FileIO(txtfile, 'wb'),
service.files().export_media(fileId=res['id'], mimeType="text/plain")
)
done = False
while done is False:
status, done = downloader.next_chunk()
service.files().delete(fileId=res['id']).execute()
print("Done.")
if __name__ == '__main__':
main()
This is a sample script for converting a PDF file to a TXT file. 2 steps are required for this.
- Upload a PDF file as a Google Document
- Download a Google Document as a TXT file
In this sample, Python Quickstart is used. The detail information is https://developers.google.com/drive/v3/web/quickstart/python. Please read “Step 1: Turn on the Drive API” and “Step 2: Install the Google Client Library”.
from __future__ import print_function
import httplib2
import os
import io
from apiclient import discovery
from oauth2client import client
from oauth2client import tools
from oauth2client.file import Storage
from apiclient.http import MediaFileUpload, MediaIoBaseDownload
try:
import argparse
flags = argparse.ArgumentParser(parents=[tools.argparser]).parse_args()
except ImportError:
flags = None
SCOPES = 'https://www.googleapis.com/auth/drive'
CLIENT_SECRET_FILE = 'client_secret.json'
APPLICATION_NAME = 'Drive API Python Quickstart'
def get_credentials():
credential_path = os.path.join("./", 'drive-python-quickstart.json')
store = Storage(credential_path)
credentials = store.get()
if not credentials or credentials.invalid:
flow = client.flow_from_clientsecrets(CLIENT_SECRET_FILE, SCOPES)
flow.user_agent = APPLICATION_NAME
if flags:
credentials = tools.run_flow(flow, store, flags)
else: # Needed only for compatibility with Python 2.6
credentials = tools.run(flow, store)
print('Storing credentials to ' + credential_path)
return credentials
def main():
credentials = get_credentials()
http = credentials.authorize(httplib2.Http())
service = discovery.build('drive', 'v3', http=http)
pdffile = 'sample.pdf'
txtfile = 'sample.txt'
mime = 'application/vnd.google-apps.document'
res = service.files().create(
body={
'name': pdffile,
'mimeType': mime
},
media_body=MediaFileUpload(pdffile, mimetype=mime, resumable=True)
).execute()
dl = MediaIoBaseDownload(
io.FileIO(txtfile, 'wb'),
service.files().export_media(fileId=res['id'], mimeType="text/plain")
)
done = False
while done is False:
status, done = dl.next_chunk()
print("Done.")
if __name__ == '__main__':
main()
Overview
This is a CLI tool to search for images with Google Reverse Image Search.
Motivation
Because I had wanted to search for images with an image URL and file on my terminal, I created this. This can download images from searched image URLs.
The detail information and how to get this are https://github.com/tanaikech/goris.
gogauth is a CLI tool to retrieve easily access token for using APIs on Google.
Today, it was updated with big changes. Please check it out.
https://github.com/tanaikech/gogauth
Released a CLI tool for easily retrieving accesstoken from Google OAuth2. The title is gogauth. When I have seen stackoverflow, I knew that it is difficult to retrieve accesstoken from Google OAuth2. So I made this.
Features of this CLI tool are as follows.
-
Retrieves easily accesstoken from Google OAuth2 for using Drive API.
-
If you have PhantomeJS, this retrieves “code” from Google using it. So you don’t need to launch your browser for retrieving “code”.
It is necessary to retrieve access token on Google. Scope is as follows.
https://www.googleapis.com/auth/drive
Other mimetypes can be seen here.
Download and convert from Spreadsheet to Excel
curl -X GET -sSL \
-H "Authorization: Bearer [Your access token]" \
-o "Excel file name" \
"https://www.googleapis.com/drive/v3/files/[File ID]/export?mimeType=application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
Upload and convert from Excel to Spreadsheet
curl -X POST -sSL \
-H "Authorization: Bearer [Your access token]" \
-F "metadata={ \
name : '[File name on Google Drive]', \
mimeType : 'application/vnd.google-apps.spreadsheet' \
};type=application/json;charset=UTF-8" \
-F "file=@[Your Excel file];type=application/vnd.ms-excel" \
"https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart"
Kanshi TANAIKE
Abstract
I considered an efficient algorithm for summation of array elements. All elements in an array are string. When those elements are summed using scripts, a standard method is to add each element in order. If the script is run without any optimize, the process becomes gradually sluggish, because the total amount of active data during the summation process is proportional to the square of the number of array elements. This leads directly to the high process-cost. Such phenomenon notably appears at Google Apps Script (GAS). This report says about the solution of this problem using a new algorithm of a pyramid method. The pyramid method achieves that the total amount of active data increases proportional to the linear of the number of array elements. By this, the processing time becomes much shorter than that of the process using the standard method. The pyramid method achieved the process-cost reduction of $99.7%$ compared with the standard method at GAS. I realized again that new discoveries are hidden into the familiar scenes of every-day life.