Hi everyone,

I was wondering why when I try to extract the asset name of Youtube videos 
using the query attached to the email, what I receive is the following 
output:


*Query preview:*
query = ('SELECT asset.name, asset.youtube_video_asset.youtube_video_id 
FROM asset '
           'WHERE asset.type = \'YOUTUBE_VIDEO\' ')

  results = ga_service.search(customer_id, query=query, page_size=page_size)

  try:
      count = 0
      for row in results:
          asset = row.asset
          count += 1
          print(f'Video with name "{asset.name}"')
          print(f'Video with ID 
"{asset.youtube_video_asset.youtube_video_id}"')
      print(f'Total of {count} videos(s) found.')


*Output:*
Video with name ""
Video with ID value: "8XXXXXXXXX8
Video with name "" 
Video with ID "value: "ZXXXXXXXXXY"
Video with name "" 
Video with ID "value: "BXXXXXXXXXo" 
Video with name "" 
Video with ID "value: "JXXXXXXXXXY"

You can observe that only the video ID is returned and the name of the 
video returns empty always. In the case of changing the where filter from :
asset.type = \'YOUTUBE_VIDEO\'  to asset.type = \'IMAGE\' or even 
asset.type = \'MEDIA_BUNDLE\'the name field name always returns the correct 
name of the asset.

So my question is: Why is this happening only with videos? Is there a 
problem in the API or it's programmed to not return the name of youtube 
video asset? And finally, how can I retrieve the name of my youtube videos 
that are currently running in my App Campaigns?


Best


 

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/eef47fc1-a665-4bf0-8815-ac6736e8e3a0n%40googlegroups.com.
# print("===========================================================\n")
# print("===========================================================\n")
# print("          Collecting Data\n")
# print("==========================================================\n")
# print("==========================================================\n")

 
# DataFrame
data = []

def main(client, customer_id, page_size):
  
  #Google Ads Service

  ga_service = client.get_service('GoogleAdsService', version='v3')

  query = ('SELECT asset.name, asset.youtube_video_asset.youtube_video_id FROM asset '
           'WHERE asset.type = \'YOUTUBE_VIDEO\'')

  results = ga_service.search(customer_id, query=query, page_size=page_size)

  try:
      count = 0
      for row in results:
          asset = row.asset
          count += 1
          print(f'Video with name "{asset.name}"')
          print(f'Video with ID "{asset.youtube_video_asset.youtube_video_id}"')
      print(f'Total of {count} videos(s) found.')

  except google.ads.google_ads.errors.GoogleAdsException as ex:
    print('Request with ID "%s" failed with status "%s" and includes the '
          'following errors:' % (ex.request_id, ex.error.code().name))
    for error in ex.failure.errors:
        print('\tError with message "%s".' % error.message)
        if error.location:
            for field_path_element in error.location.field_path_elements:
                print('\t\tOn field: %s' % field_path_element.field_name)

# Start code -----------------------------------------------------------------                    
for customer_id in accounts:
  
  if __name__ == '__main__':
        
      # GoogleAdsClient will read the google-ads.yaml configuration file in the
      # home directory if none is specified.
      google_ads_client = (google.ads.google_ads.client.GoogleAdsClient
                           .load_from_storage(yaml_path))

      main(google_ads_client, customer_id = customer_id, page_size = 1000)

        
print("\n\n ALL TASKS COMPLETED! \n\n")

Reply via email to