difference between http request block and shell curl command

已查看 176 次
跳至第一个未读帖子

Shari Shark

未读,
2021年5月10日 09:19:122021/5/10
收件人 Automate
I've recently tried to create a flow which pulls info from youtube music.

Initially I tried to use the http request block and set the user-agent to "Mozilla/5.0 (Linux; Android 10) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.91 Mobile Safari/537.36". However, the result is that Youtube music replies that "Your browser is deprecated. Please upgrade."

I found that when I used curl (via the shell command block) I can get the correct results.
The code i'm using is below:

```
curl -H "User-Agent: Mozilla/5.0 (Linux; Android 10) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.91 Mobile Safari/537.36" "http://music.youtube.com"
```

However, most Android OS won't have curl in their shell commands (only busybox or some terminal tools are installed).

Hence, two questions here.

1. Why does the http request block do not give the correct result even with a user-agent? what am i missing?

2. What is the difference between the shell curl command and the http request block?

I would like to use the http request block if possible, otherwise the flow I created is quite restrictive.

Henrik "The Developer" Lindqvist

未读,
2021年5月10日 15:40:362021/5/10
收件人 Automate
Setting the User-Agent header should work, e.g. Headers= { "User-Agent": "Mozilla/5.0 (Linux; Android 10) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.91 Mobile Safari/537.36" }

How is the block configured?

Android version?

Shari Shark

未读,
2021年5月10日 22:32:032021/5/10
收件人 Automate
The http request block is configured as follow:
Request Headers: "User-Agent:Mozilla/5.0 (Linux; Android 10) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.91 Mobile Safari/537.36"
Save response: Save variable as text
Response content or filename: content

I used both Android 7 and 10. Also my automate version is 1.28.2 on both devices.

The weird thing is I used a Dialog web block for https://music.youtube.com and it works fine. 

Henrik "The Developer" Lindqvist

未读,
2021年5月11日 01:04:542021/5/11
收件人 Automate
Request headers must be an Dictionary, e.g:
  • Request headers= { "User-Agent": "Mozilla/5.0 (Linux; Android 10) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.91 Mobile Safari/537.36" }

Shari Shark

未读,
2021年5月11日 01:10:382021/5/11
收件人 Automate
AHHH! I should have read the documentation closer... thanks.
回复全部
回复作者
转发
0 个新帖子