I have been struggling with this one for a while.
I am trying to download CSV file generated by Google Adwords "download report" button. I can click the link just fine and see the resource in the background. The problem is that in order to download it, casperJS/phantomJS requires a URL to the file... but the CSV is generated on the spot and has the same URL as the page I am on (following that link just leads you to the homepage, not the CSV file so casperJS can't download it).
Is there a way to save that resource without the URL?
I found this workaround: downloading a file that comes as an attachment in a POST request response in PhantomJs
But unfortunately, Google Adwords report button has no form that I can reference.
I did a simple request analysis with chrome developer tools: The download request goes (for me) to the following URL:
Request URL:https://adwords.google.com/reports/advanced/ReportDownload?authuser=0
Formdata:
__rds:{{censored}}
__rrd:{{censored}}
__u:{{censored}}
__c:{{censored}}
__rfl:8,9,10
token:{{censored}}:{{censored}}
Request Headers:
:authority:adwords.google.com
:method:POST
:path:/reports/advanced/ReportDownload?authuser=0
:scheme:https
accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/ *;q=0.8
accept-encoding:gzip, deflate
accept-language:en-US,en;q=0.8,de-DE;q=0.6,de;q=0.4,hr;q=0.2,sr;q=0.2
cache-control:max-age=0
content-length:501
content-type:application/x-www-form-urlencoded
cookie: {{censored}}
dnt:1
origin:https://adwords.google.com
referer:https://adwords.google.com/reports/advanced/AdvancedReporting?__c={{censored}}&__u={{censored}}&authuser=0&__o=cues
upgrade-insecure-requests:1
user-agent:Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36
x-client-data:{{censored}}
I have removed data potentially specific to me by replacing it with the {{censored}} tag.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With