html - 自定义 Google 搜索(不是 Google 自定义搜索)
问题描述
有人可以向我解释一下这个 HTML 是如何工作的吗?我想做一些可以执行此搜索的东西:
https://www.google.com/search?q=%25s&client=firefox-b-1-d&biw=1366&bih=614&tbm=isch&source=lnt&tbs=isz:ex,iszw:7680,iszh:4320
我使用 Inspect Element 从InternetTIPS.com获取此 HTML :
<div><form action="https://www.google.com/search" method="get" name="{5C088896-C4CC-4430-A6D8-9DC9D2BE379D}" target="_top"><input maxlength="255" name="q" size="35" type="text"><input name="Overview" type="hidden" value="1"><input name="internettips" type="submit" value="Find Flash Files"><input name="as_filetype" type="hidden" value="swf"></form></div>
在此处查看 HTML 功能的演示。先感谢您。
解决方案
将搜索表单添加到在 Google 中搜索特定大小的图像的页面中,您只需使用以下 HTML:
<!-- This is a search form that will take us to
https://www.google.com/search?tbm=isch&tbs=isz:ex,iszw:7680,iszh:4320&q=example
when we search for . This search will show us only images, and
those images will all be 7680 pixels wide and 4320 pixels tall.
First we enclose everything in a <> whose is everything that
the search engine results page’s URI to the left of the question mark (?)
in it -->
<form action="https://www.google.com/search" method="get">
<!-- Next, we add the arguments that are added to the Google URI. For each
part of the URI we want to build, we need an <> element with a
attribute. -->
<!-- build = -->
<!-- needs to be set to , which tells Google we want only
image search results. We add ="" to the input element
because we don’t want the end user to have to choose that
themself -->
<input name="tbm" value="isch" type="hidden">
<!-- build =:,:,: -->
<!-- needs to be set to a three-part parameter that tells Google
we’re doing a search for images of a certain size and what the
dimensions we’re looking for are -->
<input name="tbs" value="isz:ex,iszw:7680,iszh:4320" type="hidden">
<!-- build = (but ours won’t specify "example" — the user
will decide what to search for). This parameter’s is
not but rather , which is what we’ll ask the user to
enter. -->
<!-- If we don’t want to prompt our users’ imaginations,
we could remove ="" -->
<!-- ="" means that the field where the user will input their
query is about 35 characters wide on page load -->
<input name="q" size="35" type="text" placeholder="puppies">
<!-- Finally, we add the button the user can tap to enter their query,
so our is . We can set our value to whatever we want
our button to say -->
<input type="submit" value="Find images of size 7680px × 4320px">
<!-- <> is the only element we have used that we must close -->
</form>
推荐阅读
- x86-64 - 为什么 `long double` 需要 16 字节对齐?
- c++ - C++ 从 .txt 读取、存储和比较汉字
- python - 通过从 dict 列中提取一些键/值对,同时将其他键/值对保留为新记录,对数据帧进行反规范化
- javascript - 如何将可读的 JS 转换为 Native 混淆代码
- c# - 为什么这个 Fixture 不止一次运行它的构造函数?
- loops - 使用 Python3,我想减少 if-elif 代码
- react-admin - update 和 updateMany previousData 参数的 react-admin 文档
- python - 数据流中的 ValueError:无效的 GCS 位置:无
- java - JBoss EAP 7.2 EJB 服务器到客户端通信,无需 http
- xml - 使用 XML::Simple 将 XML 解析为散列时如何保留前导空格