1

I'm trying to automate the collection of Youtube channel statistics information using the Youtube Analytics API.

I was able to gather most of the stats I needed, but the stats for City Dimension are hard to process because city names are written in local languages. Youtube's Channel Analytics provides city names based on the language settings of my account.

Does anyone know how to get the city name returned in English? Or is there a standard for converting local language city names to English?

City Dimension statistical data

Youtube Channel Analytics

I based my code on the Python sample code provided on the Google Developers (https://developers.google.com/youtube/analytics/reference/reports/query) website. The API request worked normally, but it is very difficult to process because the returned city name is in the local language.

  analyticsLastMonthDF = execute_api_request_anal(
      youtubeAnalytics.reports().query,
      ids='channel==MINE',
      startDate= str(dateBefore1Month.strftime('%Y')) + '-' + str(dateBefore1Month.strftime('%m')) + '-01',
      endDate= str(dateToday.strftime('%Y')) + '-' + str(dateToday.strftime('%m')) + '-01',
      metrics = 'views,estimatedMinutesWatched',
      dimensions='city',
      sort='-estimatedMinutesWatched',
      maxResults='20'
  )
  analyticsLastMonthDF.to_csv('result_statistics.csv', mode='a')
Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
CTR_RPAMon
  • 11
  • 1

0 Answers0