Use consistent header for all result types (#535)
Introduces a header for switching between result types (i.e. "All", "News", etc) that is consistent between the different result types. Previously, image results had a tab header that was formatted in a drastically different manner, which was jarring when switching from a different result page to the Images page. Created a G class enum to reference class names returned in search results. As noted in the class doc, this should only be used/updated as a last resort, as class names change frequently. For some instances, such as replacing the tbm tab, it's a lot easier to just replace by header name than attempting to replace it based on how the element is structured. Also updated a few styles to revert the latest styling changes being applied by Google. Co-authored-by: jacr13 <ramos.joao@protonmail.com> Co-authored-by: Ben Busby <contact@benbusby.com>pull/647/head
parent
4aa94a5d75
commit
11099f7b1d
@ -0,0 +1,16 @@
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class GClasses(Enum):
|
||||
"""A class for tracking obfuscated class names used in Google results that
|
||||
are directly referenced in Whoogle's filtering code.
|
||||
|
||||
Note: Using these should be a last resort. It is always preferred to filter
|
||||
results using structural cues instead of referencing class names, as these
|
||||
are liable to change at any moment.
|
||||
"""
|
||||
main_tbm_tab = 'KP7LCb'
|
||||
images_tbm_tab = 'n692Zd'
|
||||
|
||||
def __str__(self):
|
||||
return self.value
|
@ -0,0 +1,38 @@
|
||||
{
|
||||
"all": {
|
||||
"tbm": null,
|
||||
"href": "search?q={query}",
|
||||
"name": "All",
|
||||
"selected": true
|
||||
},
|
||||
"images": {
|
||||
"tbm": "isch",
|
||||
"href": "search?q={query}",
|
||||
"name": "Images",
|
||||
"selected": false
|
||||
},
|
||||
"maps": {
|
||||
"tbm": null,
|
||||
"href": "https://maps.google.com/maps?q={query}",
|
||||
"name": "Maps",
|
||||
"selected": false
|
||||
},
|
||||
"videos": {
|
||||
"tbm": "vid",
|
||||
"href": "search?q={query}",
|
||||
"name": "Videos",
|
||||
"selected": false
|
||||
},
|
||||
"news": {
|
||||
"tbm": "nws",
|
||||
"href": "search?q={query}",
|
||||
"name": "News",
|
||||
"selected": false
|
||||
},
|
||||
"books": {
|
||||
"tbm": "bks",
|
||||
"href": "search?q={query}",
|
||||
"name": "Books",
|
||||
"selected": false
|
||||
}
|
||||
}
|
@ -1,116 +1,390 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta content="application/xhtml+xml; charset=utf-8" http-equiv="Content-Type"/>
|
||||
<meta content="no-cache" name="Cache-Control"/>
|
||||
<title>
|
||||
</title>
|
||||
<div>
|
||||
<style>
|
||||
a{text-decoration:none;color:inherit}a:hover{text-decoration:underline}a img{border:0}body{font-family:Roboto,Helvetica,Arial,sans-serif;padding:8px;margin:0 auto;max-width:700px;min-width:240px;}.FbhRzb{border-left:thin solid #dadce0;border-right:thin solid #dadce0;border-top:thin solid #dadce0;height:40px;overflow:hidden}.n692Zd{margin-bottom:10px}.cvifge{height:40px;border-spacing:0;width:100%;}.QvGUP{height:40px;padding:0 8px 0 8px;vertical-align:top}.O4cRJf{height:40px;width:100%;padding:0;padding-right:16px}.O1ePr{height:40px;padding:0;vertical-align:top}.kgJEQe{height:36px;width:98px;vertical-align:top;margin-top:4px}.lXLRf{vertical-align:top}.MhzMZd{border:0;vertical-align:middle;font-size:14px;height:40px;padding:0;width:100%;padding-left:16px}.xB0fq{height:40px;border:none;font-size:14px;background-color:#4285f4;color:#fff;padding:0 16px;margin:0;vertical-align:top;cursor:pointer}.xB0fq:focus{border:1px solid #000}.M7pB2{border:thin solid #dadce0;margin:0 0 3px 0;font-size:13px;font-weight:500;height:40px}.euZec{width:100%;height:40px;text-align:center;border-spacing:0}table.euZec td{padding:0;width:25%}.QIqI7{display:inline-block;padding-top:4px;font-weight:bold;color:#4285f4}.EY24We{border-bottom:2px solid #4285f4}.CsQyDc{display:inline-block;color:#70757a}.TuS8Ad{font-size:14px}.HddGcc{padding:8px;color:#70757a}.dzp8ae{font-weight:bold;color:#3c4043}.rEM8G{color:#70757a}.bookcf{table-layout:fixed;width:100%;border-spacing:0}.InWNIe{text-align:center}.uZgmoc{border:thin solid #dadce0;color:#70757a;font-size:14px;text-align:center;table-layout:fixed;width:100%}.frGj1b{display:block;padding:12px 0 12px 0;width:100%}.BnJWBc{text-align:center;padding:6px 0 13px 0;height:35px}.e3goi{vertical-align:top;padding:0;height:180px}.GpQGbf{margin:auto;border-collapse:collapse;border-spacing:0;width:100%}
|
||||
html {
|
||||
font-family: Roboto, Helvetica Neue, Arial, sans-serif;
|
||||
font-size: 14px;
|
||||
line-height: 20px;
|
||||
text-size-adjust: 100%;
|
||||
color: #3c4043;
|
||||
word-wrap: break-word;
|
||||
background-color: #fff;
|
||||
}
|
||||
body {
|
||||
padding: 0 8px;
|
||||
margin: 0 auto;
|
||||
max-width: 736px;
|
||||
}
|
||||
a {
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
}
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
a img {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.FbhRzb {
|
||||
border-left: thin solid #dadce0;
|
||||
border-right: thin solid #dadce0;
|
||||
border-top: thin solid #dadce0;
|
||||
height: 40px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.n692Zd {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.cvifge {
|
||||
height: 40px;
|
||||
border-spacing: 0;
|
||||
width: 100%;
|
||||
}
|
||||
.QvGUP {
|
||||
height: 40px;
|
||||
padding: 0 8px 0 8px;
|
||||
vertical-align: top;
|
||||
}
|
||||
.O4cRJf {
|
||||
height: 40px;
|
||||
width: 100%;
|
||||
padding: 0;
|
||||
padding-right: 16px;
|
||||
}
|
||||
.O1ePr {
|
||||
height: 40px;
|
||||
padding: 0;
|
||||
vertical-align: top;
|
||||
}
|
||||
.kgJEQe {
|
||||
height: 36px;
|
||||
width: 98px;
|
||||
vertical-align: top;
|
||||
margin-top: 4px;
|
||||
}
|
||||
.lXLRf {
|
||||
vertical-align: top;
|
||||
}
|
||||
.MhzMZd {
|
||||
border: 0;
|
||||
vertical-align: middle;
|
||||
font-size: 14px;
|
||||
height: 40px;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
padding-left: 16px;
|
||||
}
|
||||
.xB0fq {
|
||||
height: 40px;
|
||||
border: none;
|
||||
font-size: 14px;
|
||||
background-color: #4285f4;
|
||||
color: #fff;
|
||||
padding: 0 16px;
|
||||
margin: 0;
|
||||
vertical-align: top;
|
||||
cursor: pointer;
|
||||
}
|
||||
.xB0fq:focus {
|
||||
border: 1px solid #000;
|
||||
}
|
||||
.M7pB2 {
|
||||
border: thin solid #dadce0;
|
||||
margin: 0 0 3px 0;
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
height: 40px;
|
||||
}
|
||||
.euZec {
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
text-align: center;
|
||||
border-spacing: 0;
|
||||
}
|
||||
table.euZec td {
|
||||
padding: 0;
|
||||
width: 25%;
|
||||
}
|
||||
.QIqI7 {
|
||||
display: inline-block;
|
||||
padding-top: 4px;
|
||||
font-weight: bold;
|
||||
color: #4285f4;
|
||||
}
|
||||
.EY24We {
|
||||
border-bottom: 2px solid #4285f4;
|
||||
}
|
||||
.CsQyDc {
|
||||
display: inline-block;
|
||||
color: #70757a;
|
||||
}
|
||||
.TuS8Ad {
|
||||
font-size: 14px;
|
||||
}
|
||||
.HddGcc {
|
||||
padding: 8px;
|
||||
color: #70757a;
|
||||
}
|
||||
.dzp8ae {
|
||||
font-weight: bold;
|
||||
color: #3c4043;
|
||||
}
|
||||
.rEM8G {
|
||||
color: #70757a;
|
||||
}
|
||||
.bookcf {
|
||||
table-layout: fixed;
|
||||
width: 100%;
|
||||
border-spacing: 0;
|
||||
}
|
||||
.InWNIe {
|
||||
text-align: center;
|
||||
}
|
||||
.uZgmoc {
|
||||
border: thin solid #dadce0;
|
||||
color: #70757a;
|
||||
font-size: 14px;
|
||||
text-align: center;
|
||||
table-layout: fixed;
|
||||
width: 100%;
|
||||
}
|
||||
.frGj1b {
|
||||
display: block;
|
||||
padding: 12px 0 12px 0;
|
||||
width: 100%;
|
||||
}
|
||||
.BnJWBc {
|
||||
text-align: center;
|
||||
padding: 6px 0 13px 0;
|
||||
height: 35px;
|
||||
}
|
||||
.e3goi {
|
||||
vertical-align: top;
|
||||
padding: 0;
|
||||
height: 180px;
|
||||
}
|
||||
.GpQGbf {
|
||||
margin: auto;
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
width: 100%;
|
||||
}
|
||||
.X6ZCif {
|
||||
color: #202124;
|
||||
font-size: 11px;
|
||||
line-height: 16px;
|
||||
display: inline-block;
|
||||
padding-top: 2px;
|
||||
overflow: hidden;
|
||||
padding-bottom: 4px;
|
||||
width: 100%;
|
||||
}
|
||||
.TwVfHd {
|
||||
border-radius: 16px;
|
||||
border: thin solid #dadce0;
|
||||
display: inline-block;
|
||||
padding: 8px 8px;
|
||||
margin-right: 8px;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
.yekiAe {
|
||||
background-color: #dadce0;
|
||||
}
|
||||
.svla5d {
|
||||
width: 100%;
|
||||
}
|
||||
.ezO2md {
|
||||
border: thin solid #dadce0;
|
||||
padding: 12px 16px 12px 16px;
|
||||
margin-bottom: 10px;
|
||||
font-family: Roboto, Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
.TxbwNb {
|
||||
border-spacing: 0;
|
||||
}
|
||||
.K35ahc {
|
||||
width: 100%;
|
||||
}
|
||||
.owohpf {
|
||||
text-align: center;
|
||||
}
|
||||
.RAyV4b {
|
||||
width: 162px;
|
||||
height: 140px;
|
||||
line-height: 140px;
|
||||
overflow: "hidden";
|
||||
text-align: center;
|
||||
}
|
||||
.t0fcAb {
|
||||
text-align: center;
|
||||
margin: auto;
|
||||
vertical-align: middle;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: contain;
|
||||
}
|
||||
.Tor4Ec {
|
||||
padding-top: 2px;
|
||||
padding-bottom: 8px;
|
||||
}
|
||||
.fYyStc {
|
||||
word-break: break-word;
|
||||
}
|
||||
.ynsChf {
|
||||
display: block;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.Fj3V3b {
|
||||
color: #1967d2;
|
||||
font-size: 14px;
|
||||
line-height: 20px;
|
||||
}
|
||||
.FrIlee {
|
||||
color: #202124;
|
||||
font-size: 11px;
|
||||
line-height: 16px;
|
||||
}
|
||||
.F9iS2e {
|
||||
color: #70757a;
|
||||
font-size: 11px;
|
||||
line-height: 16px;
|
||||
}
|
||||
.WMQ2Le {
|
||||
color: #70757a;
|
||||
font-size: 12px;
|
||||
line-height: 16px;
|
||||
}
|
||||
.x3G5ab {
|
||||
color: #202124;
|
||||
font-size: 12px;
|
||||
line-height: 16px;
|
||||
}
|
||||
.fuLhoc {
|
||||
color: #1967d2;
|
||||
font-size: 18px;
|
||||
line-height: 24px;
|
||||
}
|
||||
.epoveb {
|
||||
font-size: 32px;
|
||||
line-height: 40px;
|
||||
font-weight: 400;
|
||||
color: #202124;
|
||||
}
|
||||
.dXDvrc {
|
||||
color: #0d652d;
|
||||
font-size: 14px;
|
||||
line-height: 20px;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
.dloBPe {
|
||||
font-weight: bold;
|
||||
}
|
||||
.YVIcad {
|
||||
color: #70757a;
|
||||
}
|
||||
.JkVVdd {
|
||||
color: #ea4335;
|
||||
}
|
||||
.oXZRFd {
|
||||
color: #ea4335;
|
||||
}
|
||||
.MQHtg {
|
||||
color: #fbbc04;
|
||||
}
|
||||
.pyMRrb {
|
||||
color: #1e8e3e;
|
||||
}
|
||||
.EtTZid {
|
||||
color: #1e8e3e;
|
||||
}
|
||||
.M3vVJe {
|
||||
color: #1967d2;
|
||||
}
|
||||
.qXLe6d {
|
||||
display: block;
|
||||
}
|
||||
.NHQNef {
|
||||
font-style: italic;
|
||||
}
|
||||
.Cb8Z7c {
|
||||
white-space: pre;
|
||||
}
|
||||
a.ZWRArf {
|
||||
text-decoration: none;
|
||||
}
|
||||
a .CVA68e:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<style>
|
||||
.X6ZCif{color:#202124;font-size:11px;line-height:16px;display:inline-block;padding-top:2px;overflow:hidden;padding-bottom:4px;width:100%}.TwVfHd{border-radius:16px;border:thin solid #dadce0;display:inline-block;padding:8px 8px;margin-right:8px;margin-bottom:4px}.yekiAe{background-color:#dadce0}.svla5d{width:100%}.ezO2md{border:thin solid #dadce0;padding:12px 16px 12px 16px;margin-bottom:10px;font-family:Roboto,Helvetica,Arial,sans-serif}.lIMUZd{font-family:Roboto,Helvetica,Arial,sans-serif}.TxbwNb{border-spacing:0}.K35ahc{width:100%}.owohpf{text-align:center}.RAyV4b{width:162px;height:140px;line-height:140px;overflow:'hidden';text-align:center;}.t0fcAb{text-align:center;margin:auto;vertical-align:middle;width:100%;height:100%;object-fit: contain}.Tor4Ec{padding-top:2px;padding-bottom:8px;}.fYyStc{word-break:break-word}.ynsChf{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.Fj3V3b{color:#1967D2;font-size:14px;line-height:20px}.FrIlee{color:#202124;font-size:11px;line-height:16px}.F9iS2e{color:#70757a;font-size:11px;line-height:16px}.WMQ2Le{color:#70757a;font-size:12px;line-height:16px}.x3G5ab{color:#202124;font-size:12px;line-height:16px}.fuLhoc{color:#1967D2;font-size:18px;line-height:24px}.epoveb{font-size:32px;line-height:40px;font-weight:400;color:#202124}.dXDvrc{color:#0d652d;font-size:14px;line-height:20px;word-wrap:break-word}.dloBPe{font-weight:bold}.YVIcad{color:#70757a}.JkVVdd{color:#ea4335}.oXZRFd{color:#ea4335}.MQHtg{color:#fbbc04}.pyMRrb{color:#1e8e3e}.EtTZid{color:#1e8e3e}.M3vVJe{color:#1967D2}.qXLe6d{display:block}.NHQNef{font-style:italic}.Cb8Z7c{white-space:pre}a.ZWRArf{text-decoration:none}a .CVA68e:hover{text-decoration:underline}
|
||||
</style>
|
||||
<div class="n692Zd">
|
||||
<div class="BnJWBc">
|
||||
<a class="lXLRf" href="/?safe=off&gbv=1&output=images&ie=UTF-8&tbm=isch&sa=X&ved=0ahUKEwjhh7TZyd_vAhWShf0HHeYzCmsQPAgC">
|
||||
<img alt="Google" class="kgJEQe" src="/images/branding/searchlogo/1x/googlelogo_desk_heirloom_color_150x55dp.gif"/>
|
||||
</a>
|
||||
</div>
|
||||
<div class="FbhRzb">
|
||||
<form action="/search">
|
||||
<input name="safe" type="hidden" value="off"/>
|
||||
<input name="gbv" type="hidden" value="1"/>
|
||||
<input name="ie" type="hidden" value="ISO-8859-1"/>
|
||||
<input name="tbm" type="hidden" value="isch"/>
|
||||
<input name="oq" type="hidden"/>
|
||||
<input name="aqs" type="hidden"/>
|
||||
<table class="cvifge">
|
||||
<tr>
|
||||
<td class="O4cRJf">
|
||||
<!-- search input -->
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
<div class="M7pB2">
|
||||
<!-- search options -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="X6ZCif"> Not present in mobile
|
||||
</div> -->
|
||||
<div>
|
||||
<div>
|
||||
<div>
|
||||
<div class="lIMUZd">
|
||||
<table class="By0U9">
|
||||
<!-- correction suggested -->
|
||||
</table>
|
||||
</div>
|
||||
<div class="lIMUZd">
|
||||
<table class="By0U9">
|
||||
<!-- correction suggested -->
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<table class="GpQGbf">
|
||||
{% for i in range((length // 4) + 1) %}
|
||||
<tr>
|
||||
{% for j in range([length - (i*4), 4]|min) %}
|
||||
<td align="center" class="e3goi">
|
||||
<td align="center" class="e3goi">
|
||||
<div class="svla5d">
|
||||
<div>
|
||||
<div class="lIMUZd">
|
||||
<div>
|
||||
<table class="TxbwNb">
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{{ results[(i*4)+j].web_page }}">
|
||||
<div class="RAyV4b">
|
||||
<img alt="" class="t0fcAb" src="{{ results[(i*4)+j].img_tbn }}"/>
|
||||
</div>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{{ results[(i*4)+j].web_page }}">
|
||||
<div class="Tor4Ec">
|
||||
<span class="qXLe6d x3G5ab">
|
||||
<span class="fYyStc">
|
||||
{{ results[(i*4)+j].domain }}
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</a>
|
||||
<a href="{{ results[(i*4)+j].img_url }}">
|
||||
<div class="Tor4Ec">
|
||||
<span class="qXLe6d F9iS2e">
|
||||
<span class="fYyStc">
|
||||
{{ view_label }}
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="lIMUZd">
|
||||
<div>
|
||||
<table class="TxbwNb">
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{{ results[(i*4)+j].web_page }}">
|
||||
<div class="RAyV4b">
|
||||
<img
|
||||
alt=""
|
||||
class="t0fcAb"
|
||||
src="{{ results[(i*4)+j].img_tbn }}"
|
||||
/>
|
||||
</div>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{{ results[(i*4)+j].web_page }}">
|
||||
<div class="Tor4Ec">
|
||||
<span class="qXLe6d x3G5ab">
|
||||
<span class="fYyStc">
|
||||
{{ results[(i*4)+j].domain }}
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</a>
|
||||
<a href="{{ results[(i*4)+j].img_url }}">
|
||||
<div class="Tor4Ec">
|
||||
<span class="qXLe6d F9iS2e">
|
||||
<span class="fYyStc"> {{ view_label }} </span>
|
||||
</span>
|
||||
</div>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
</td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
<table class="uZgmoc">
|
||||
<!-- next page object -->
|
||||
</table>
|
||||
<br/>
|
||||
<div class="TuS8Ad">
|
||||
<!-- information about user connection -->
|
||||
<div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
<br />
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue