+1 vote
by
How to parse the class I need (it is always different and in different places)
HTML page
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="author" content="Overmobile"/>
<meta name="keywords" content="разрушители, overmobile, овермобайл, онлайн игра, пвп, сражения, pvp, приключения, прокачка героя, арена, битва, турнир, подземелья, бесплатная, mmorpg"/>
<meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1"/>
<link rel="icon" href="http://144.76.127.94/view/image/icons/favicon.png?1" type="image/png">
<link rel="stylesheet" type="text/css" media="all" href="http://144.76.127.94/view/style/index.css?3.80" />
<title>Разрушители, эпическая онлайн игра в жанре фэнтези для мобильных телефонов.</title>
</head>
<body id="bg" >

<script language="JavaScript" type="text/javascript">
<!--
if (typeof jsInterface != 'undefined') {
jsInterface.event("user=0;level=0");
jsInterface.event("start");
};
//-->
</script>


<div class="bdr bg_blue mb2"><div class="wr1"><div class="wr2"><div class="wr3"><div class="wr4"><div class="wr5"><div class="wr6"><div class="wr7"><div class="wr8">
<div class="ml10 mb10 mr10 small cntr sh">
<img src="http://144.76.127.94/view/image/welcome.jpg" /><br/> Новая эпическая игра Разрушители!<br />Победи их всех! </div>
<div class="clb"></div>
</div></div></div></div></div></div></div></div></div>
<div class="cntr"><a href="/start" class="ubtn mt-15 inbl green mb5"><span class="ul"><span class="ur">Начать игру</span></span></a></div>
<div class="hr_g mb2"><div><div></div></div></div>
<div class="bntf"><div class="nl"><div class="nr cntr lose lh1 p5 nd sh">
Поставьте галочку "я не робот" </div>
<div class="hr_g mb2"><div><div></div></div></div>


<div class="bdr bg_blue mb2"><div class="wr1"><div class="wr2"><div class="wr3"><div class="wr4"><div class="wr5"><div class="wr6"><div class="wr7"><div class="wr8">
<div class="ml10 mt10 mb10 mr10 cntr sh">
<form action="/login" method="POST">
Имя<div class="mb2"></div>
<input type="text" name="name" value="Прололоj"/><div class="mb2"></div>
Пароль<div class="mb2"></div>
<input type="password" name="password" value=""/><div class="mb5"></div>
<style>
.c3036355563{
height: 0px;
left: 6px;
overflow: hidden;
}
.c3036355563 input {
/*transform: scale(1.8);
-ms-transform: scale(1.8);
-webkit-transform: scale(1.8);*/
vertical-align: middle;
margin-right: 10px;
}
</style><div class="c2345831655"><div class="c3036355563"><div class="c1800105812"><div class="c4205609495"><div class="c3366647838"><div class="c1444783868"><div class="c2069452229"><div class="c1709087294"><label><input type="checkbox" class="c3554996014" name="c3554996014" value="">я не робот</label></div></div></div></div></div></div></div></div><style>
.c2214656208{
margin-top: 15px;
margin-bottom: 15px;
left: 19px;
display: none;
}
.c2214656208 input {
/*transform: scale(1.8);
-ms-transform: scale(1.8);
-webkit-transform: scale(1.8);*/
vertical-align: middle;
margin-right: 10px;
}
</style><div class="c329963392"><div class="c986752856"><div class="c2214656208"><div class="c2242802122"><div class="c3130538944"><div class="c1831216109"><div class="c2294993933"><label><input type="checkbox" class="c2447332093" name="c2447332093" value="">я не робот</label></div></div></div></div></div></div></div><style>
.c3316555326{
height: 0px;
left: 4px;
overflow: hidden;
}
.c3316555326 input {
/*transform: scale(1.8);
-ms-transform: scale(1.8);
-webkit-transform: scale(1.8);*/
vertical-align: middle;
margin-right: 10px;
}
</style><div class="c1269273540"><div class="c3316555326"><div class="c2840803220"><div class="c1519917189"><div class="c607056098"><div class="c875518972"><div class="c383780893"><div class="c3720271473"><label><input type="checkbox" class="c4227049932" name="c4227049932" value="">я не робот</label></div></div></div></div></div></div></div></div><style>
.c2196259601{
height: 0px;
left: 33px;
overflow: hidden;
}
.c2196259601 input {
/*transform: scale(1.8);
-ms-transform: scale(1.8);
-webkit-transform: scale(1.8);*/
vertical-align: middle;
margin-right: 10px;
}
</style><div class="c3759226460"><div class="c3373546233"><div class="c931184193"><div class="c2377245924"><div class="c2332748725"><div class="c400353167"><div class="c2196259601"><label><input type="checkbox" class="c266243806" name="c266243806" value="">я не робот</label></div></div></div></div></div></div></div><style>
.c4113532352{
margin-top: 15px;
margin-bottom: 15px;
float: left;
margin-left: -2385px;
left: 36px;
}
.c4113532352 input {
/*transform: scale(1.8);
-ms-transform: scale(1.8);
-webkit-transform: scale(1.8);*/
vertical-align: middle;
margin-right: 10px;
}
</style><div class="c4113532352"><div class="c3640726280"><div class="c2154474065"><div class="c1603628046"><div class="c3979650701"><div class="c3828942860"><div class="c1400675795"><label><input type="checkbox" class="c3448837050" name="c3448837050" value="">я не робот</label></div></div></div></div></div></div></div><style>
.c4157746125{
margin-top: 15px;
margin-bottom: 15px;
left: 5px;
}
.c4157746125 input {
/*transform: scale(1.8);
-ms-transform: scale(1.8);
-webkit-transform: scale(1.8);*/
vertical-align: middle;
margin-right: 10px;
}
</style><div class="c726180677"><div class="c2693016984"><div class="c4157746125"><div class="c40714962"><div class="c3577236507"><div class="c4237752558"><label><input type="checkbox" class="c3596661599" name="c3596661599" value="">я не робот</label></div></div></div></div></div></div> <span class="ubtn inbl green"><span class="ul"><input class="ur" type="submit" value="Войти" /></span></span>
</form>
<div class="mt10 small">
<a href="/recover_pw" class="darkgreen_link">Забыли пароль?</a> </div>
</div>
<div class="clb"></div>
</div></div></div></div></div></div></div></div></div>

<div class="hr_g mb2"><div><div></div></div></div>
<div class="cntr mb5"><a class="small grey1" href="/about_all">Соглашение</a></div>
<!-- VK21772 -->



<div class="ftr small"><div class="ftr_r cntr"><div class="grey2">0.003 сек, 18:17:23<br />Overmobile © 2020, 16+<br /><br /><div class="f-block"><script type="text/javascript" src="http://mobtop.ru/c/74157.js"></script><noscript><a href="http://mobtop.ru/in/74157"><img src=" alt="MobTop.Ru - Рейтинг и статистика мобильных сайтов"/></a></noscript></div></div></div></div><div class="hr_g mb2"><div><div></div></div></div>




</body>
</html>
I need to get this class c3596661599 (remember it is always different and in different places) In python it works like this
styles = soup.find_all('style')
for style in styles:
if not "none" in str(style):
if not "hidden" in str(style):
try:
find = str(style).split('margin-left: ')[1].split('px')[0]
except:
find = str(style).split('.')[1].split('{')[0]
div = soup.find('div', {"class": find})
id = str(div).split('" type="checkbox" value=""/>я не')[0].split('"')[-1]
data[id] = ""
But I need it in js
by
kpkkk423 , understandably
by
loonny I'm not from Russia + we didn't learn Russian at school
by
DevMan The point of the question is how to find it through python and I need to js
by
kpkkk423 I'm not asking "how to find it," I'm asking "what is the criterion for determining that this is the right one and not the other.
by
Why don't you use the same algorithm you use in python?
by
kpkkk423 I know it's indecent to ask, but what was your grade in Russian and literature at school?
by
kpkkk423 and how do you know you need this one if "it's always different and in different places"?

1 Answer

+1 vote
by
Is this code straight out of 1999? Why do you need < !-- /--> inside<script></script> In 2020? xDDD
Can you explain in words what you need? I couldn't find the c3596661599 class in the code you provided.
by
kpkkk423 So do you want the HTML element or the class? Make up your mind.
by
It is better to look or create an html file and paste the whole html page
p.s here's a piece of everything I posted above and it's here class c359661599
</style><div class="c726180677"><div class="c2693016984"><div class="c4157746125"><div class="c40714962"><div class="c3577236507"><div class="c4237752558"><label><input type="checkbox" class="c3596661599" name="c3596661599" value="">я не робот</label></div></div></div></div></div></div>							<span class="ubtn inbl green"><span class="ul"><input class="ur" type="submit" value="Войти" /></span></span>
by
loonny , class from the website page mrush.mobi/welcome ( press enter a couple of times and this "captcha" will appear ) you will understand what I want to parse
by
I need to get this class to send it in the post request without it there will be an error
by
kpkkk423 you are in big trouble:
1. with the Russian language
2. with a statement of his thoughts
3. with stinky crap code, which you are not even able to properly format so that it is easier to read
...