import requests
import xml.etree.ElementTree as ET
import sys
LANGUAGE = 'zh-TW'
REGION = 'TW'
TIME = 'today'
response = requests.get('http://g...content-available-to-author-only...e.com/schemas/2007/categories.cat?hl='+LANGUAGE)
categoryRoot = ET.fromstring(response.text)
atom = '{http://w...content-available-to-author-only...3.org/2005/Atom}'
yt = '{http://g...content-available-to-author-only...e.com/schemas/2007}'
file = open('output','w')
for entry in categoryRoot.findall(atom + 'category'):
	if entry.find(yt + 'assignable') is not None:
		response = requests.get('https://g...content-available-to-author-only...e.com/feeds/api/standardfeeds/TW/most_popular_'+entry.get('term')+'?time='+TIME+'&v=2&alt=json')
		#file.write(response.text)
		print (response.text.encode('cp950'))