Форум программистов, компьютерный форум, киберфорум
Python: Web
Войти
Регистрация
Восстановить пароль
Блоги Сообщество Поиск Заказать работу  
 
 Аватар для Orlov1
100 / 42 / 7
Регистрация: 03.02.2019
Сообщений: 655

Bs 4 Спарсить значение из html next_element

14.06.2022, 23:58. Показов 568. Ответов 5
Метки нет (Все метки)

Студворк — интернет-сервис помощи студентам
Всем привет !

Есть HTML код:

HTML5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<label class="visible-xs col-xs-4" for="onum3">Invoice</label>
<div class="col-sm-12 col-xs-8">629794</div>
</div>
</div>
<div class="col-lg-2 col-sm-2">
<div class="row">
<label class="visible-xs col-xs-4" for="odate3">Date</label>
<div class="col-sm-12 col-xs-8">5/9/2018</div>
</div>
</div>
<div class="col-lg-3 col-sm-3">
<div class="row">
<label class="visible-xs col-xs-4" for="oitemID3">Item ID</label>
<div class="col-sm-12 col-xs-8">JustFlight-TB10-20</div>
</div>
</div>
<div class="col-lg-3 col-sm-3 text-left">
<div class="row">
<label class="visible-xs col-xs-4" for="oitem3">Item</label>
<div class="col-sm-12 col-xs-8">TB-10 TOBAGO &amp; TB-20 TRINIDAD<br>Serial: OUIO-OIPU </div>
</div>
</div>
<div class="col-lg-2 col-sm-2 text-right">
<div class="row">
<label class="visible-xs col-xs-4" for="odownload3">Download</label>
 
<div class="col-sm-12 col-xs-8"><a href="https://site.org/order_eproduct.asp?action=edownload&amp;eid=2ECCBA59t5QBjCj" target="_blank" class="icon-btn icon-btn-refresh">Download Item</a></div>
 
</div>
</div>
</div>
<div class="row trackOrders_details details_row">
<div class="col-lg-2 col-sm-2">
<div class="row">
<label class="visible-xs col-xs-4" for="onum3">Invoice</label>
<div class="col-sm-12 col-xs-8">363893</div>
</div>
</div>
<div class="col-lg-2 col-sm-2">
<div class="row">
<label class="visible-xs col-xs-4" for="odate3">Date</label>
<div class="col-sm-12 col-xs-8">9/16/2016</div>
</div>
</div>
<div class="col-lg-3 col-sm-3">
<div class="row">
<label class="visible-xs col-xs-4" for="oitemID3">Item ID</label>
<div class="col-sm-12 col-xs-8">Carenado-CT210M</div>
</div>
</div>
<div class="col-lg-3 col-sm-3 text-left">
<div class="row">
<label class="visible-xs col-xs-4" for="oitem3">Item</label>
<div class="col-sm-12 col-xs-8">CT210M CENTURION II HD SERIES</div>
</div>
</div>
<div class="col-lg-2 col-sm-2 text-right">
<div class="row">
<label class="visible-xs col-xs-4" for="odownload3">Download</label>
 
<div class="col-sm-12 col-xs-8"><a href="https://site.org/order_eproduct.asp?action=edownload&amp;eid=uEHVF7CcqpRIChi" target="_blank" class="icon-btn icon-btn-refresh">Download Item</a></div>
 
</div>
</div>
</div>
<div class="row trackOrders_details details_row">
<div class="col-lg-2 col-sm-2">
<div class="row">
<label class="visible-xs col-xs-4" for="onum3">Invoice</label>
<div class="col-sm-12 col-xs-8">363394</div>
</div>
</div>
<div class="col-lg-2 col-sm-2">
<div class="row">
<label class="visible-xs col-xs-4" for="odate3">Date</label>
<div class="col-sm-12 col-xs-8">9/13/2016</div>
</div>
</div>
<div class="col-lg-3 col-sm-3">
<div class="row">
<label class="visible-xs col-xs-4" for="oitemID3">Item ID</label>
<div class="col-sm-12 col-xs-8">Alabeo-DA40</div>
</div>
</div>
<div class="col-lg-3 col-sm-3 text-left">
<div class="row">
<label class="visible-xs col-xs-4" for="oitem3">Item</label>
<div class="col-sm-12 col-xs-8">Alabeo Diamond DA40</div>
</div>
</div>
<div class="col-lg-2 col-sm-2 text-right">
<div class="row">
<label class="visible-xs col-xs-4" for="odownload3">Download</label>
 
<div class="col-sm-12 col-xs-8"><a href="https://store.x-plane.org/order_eproduct.asp?action=edownload&amp;eid=PsrLYJ5L1nUh7x3" target="_blank" class="icon-btn icon-btn-refresh">Download Item</a></div>
Нужно спарсить значения :
Invoice
Date
Item ID
Download

Фрагмент кода Python:

Пытаюсь спарсить значение Invoice через find_all_next. При этом код не возвращает желаемое значение.

Python
1
2
3
4
orders_req = s.get(url_orders, proxies=proxy)
                orders = soup.find_all_next('label', attrs={ "for" : "onum3"})
                for order in orders:
                    print(order)
Где допущена ошибка и как спарсить нужные значения ?
0
Programming
Эксперт
39485 / 9562 / 3019
Регистрация: 12.04.2006
Сообщений: 41,671
Блог
14.06.2022, 23:58
Ответы с готовыми решениями:

Как спарсить значение из html комментария
Комментарий примерно такого вида &quot;&lt;!--19282&lt;!&gt;&lt;!&gt;0&lt;!&gt;6704&lt;!&gt;2&lt;!&gt;429046155055&lt;!&gt;0&quot; подскажите как &quot;вытащить&quot; из него строку с...

Как получить html код страницы и спарсить значение?
подскажите как получить html код страницы и спарсить значение Вот часть html &lt;script type=&quot;text/javascript&quot;&gt; ...

Спарсить html
Как можно спарсить html документ, уже довольно долго мучаюсь с регулярками string match = Regex.Match(outdata,...

5
Эксперт по компьютерным сетям
 Аватар для Jabbson
5907 / 3359 / 1036
Регистрация: 03.11.2009
Сообщений: 10,008
15.06.2022, 02:04
неплохо было бы глянуть на всю страницу, что-то тут какие-то обрывки div-ов, начало которых не вошло в выдержку...
0
 Аватар для Orlov1
100 / 42 / 7
Регистрация: 03.02.2019
Сообщений: 655
17.06.2022, 00:10  [ТС]
Jabbson, вот код страницы полностью

HTML5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
<!DOCTYPE html>
<!-- saved from url=(0052)https://store.x-plane.org/ordertrackingX.asp?sec=pro -->
<html class="no-js" lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Welcome to X-Plane.Org Software Store  - </title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=1">
 
<link rel="alternate" type="application/rss+xml" title="Featured Items (RSS 2.0)" href="https://store.x-plane.org/rss.asp?type=home">
<link rel="alternate" type="application/rss+xml" title="Products On Sale (RSS 2.0)" href="https://store.x-plane.org/rss.asp?type=onsale">
<link rel="alternate" type="application/rss+xml" title="New Releases (RSS 2.0)" href="https://store.x-plane.org/rss.asp?type=newreleases">
<link rel="alternate" type="application/rss+xml" title="Best Sellers (RSS 2.0)" href="https://store.x-plane.org/rss.asp?type=bestsellers">
<link rel="alternate" type="application/rss+xml" title="Latest Blog Posts (RSS 2.0)" href="https://store.x-plane.org/rss.asp?type=blog">
 
 
<link rel="preconnect" href="https://fonts.gstatic.com/">
<link rel="StyleSheet" href="./Welcome to X-Plane.Org Software Store -_files/core.css" type="text/css">
<link rel="stylesheet" href="./Welcome to X-Plane.Org Software Store -_files/bootstrap.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
<noscript>
        <link
            href="assets/templates/common-core/lib/bootstrap/css/bootstrap.css?vcart=11.3.6"
            rel="stylesheet"
            type="text/css"
        />
    </noscript>
<link rel="stylesheet" href="./Welcome to X-Plane.Org Software Store -_files/fontello.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
<noscript>
        <link
            href="assets/templates/common-core/lib/fontello/css/fontello.css?vcart=11.3.6"
            rel="stylesheet"
            type="text/css"
        />
    </noscript>
<link rel="stylesheet" href="./Welcome to X-Plane.Org Software Store -_files/css2" as="style" onload="this.onload=null;this.rel='stylesheet'">
<noscript>
        <link
            href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;600;700;800&display=swap"
            rel="stylesheet"
            type="text/css"
        />
    </noscript>
<link rel="StyleSheet" href="./Welcome to X-Plane.Org Software Store -_files/default.css" type="text/css">
 
 
<script type="text/javascript" src="./Welcome to X-Plane.Org Software Store -_files/index_scr.js.Без названия"></script><style type="text/css">
.m1CL0,.m1CL0:link,.m1CL0:visited,.m1CL0:link:visited{font-family: 'Lato', sans-serif; font-size:26px; line-height:32px; font-weight:400; color:#000; text-decoration:none; text-transform:none; padding:0px; display:block;}
.m1CL0:hover{text-decoration:none; color:#fff;}
.m1mit{padding-left:5px;padding-right:15px;color:#604839; font-weight:bold; font-family:"Noto Sans", sans-serif; font-size:12px; }
</style><script type="text/javascript" src="./Welcome to X-Plane.Org Software Store -_files/menu_dom.js.Без названия"></script>
</head>
<body class="home-page noleftbar norightbar qv-enabled logged-in" data-currency="$">
<section class="header-navigation sticky-jump">
<header class="site-header">
<div class="container">
<div class="row">
<div class="hasFlex SB">
<div class="visible-xs text-center head-mobile-nav">
<a href="https://store.x-plane.org/ordertrackingX.asp?sec=pro#" id="mobile-menu-trigger">
<span class="icon-menu"></span>
<div>Menu</div>
</a>
</div>
<div class="logo">
<a href="https://store.x-plane.org/" title="X-Plane.Org Software Store"><img src="./Welcome to X-Plane.Org Software Store -_files/XPlogo-2020_Store.jpg" alt="X-Plane.Org Software Store"></a>
</div>
<div class="custom_mid hidden-xs">
<div>
<a href="https://store.x-plane.org/view_cart.asp" class="cart">
<span class="icon-basket"></span> Shopping Cart: 0 item(s) / $0
</a>
</div>
<div id="FRAME_SEARCH">
<div id="searchBox" class="searchBox hidden-sm hidden-xs">
<form method="get" name="searchForm" action="https://store.x-plane.org/search.asp">
<div class="search-form">
<label for="searchlight" class="sr-only">Product Search</label>
<input type="text" id="searchlight" name="keyword" value="" placeholder="Search" class="search-text form-control">
<button type="submit" class="search-submit btn btn-default">
 <span class="icon-search"></span> Search
</button>
</div>
<div class="searchlight-balloon" style="position: absolute; z-index: 1005; top: 40px; display: none; left: 0px;"><div class="searchlight-results-wrapper" style="height: 100%;"></div></div></form>
<div class="clear"></div>
</div>
</div>
</div>
<div class="visible-xs text-center head-mobile-nav">
<a href="https://store.x-plane.org/ordertrackingX.asp?sec=pro#" class="pull-right" data-toggle="modal" data-target="#searchModal">
<span class="sr-only">Search</span>
<span class="icon-search"></span>
<div>Search</div>
</a>
</div>
</div>
<div class="visible-sm">
<div class="hasFlex SB">
<div id="TabSearchBox" class="searchBox">
<form method="get" name="TabsearchForm" action="https://store.x-plane.org/search.asp">
<div class="search-form">
<label for="searchlight3" class="sr-only">Product Search</label>
<input type="text" id="searchlight3" name="keyword" value="" placeholder="Search" class="search-text form-control">
<button type="submit" class="search-submit btn btn-default">
<span class="icon-search"></span> Search
</button>
</div>
</form>
</div>
<a href="https://store.x-plane.org/ordertrackingX.asp?sec=pro#" id="mobile-menu-trigger5">
<span class="icon-menu"></span>
<div class="sr-only">Menu</div>
</a>
</div>
</div>
</div>
</div>
</header>
</section>
<section id="caTnaV" class="categoriesNav navbar-wrapper hidden-sm hidden-xs">
<nav id="menulinks-outer" class="hasFlex"><ul id="menulinks" class="nav navbar-nav">
<li id="sticky-toggle" class="widget-header hidden"><a href="https://store.x-plane.org/ordertrackingX.asp?sec=pro#"><span class="icon-menu"></span></a></li>
<li class="visible-xs"><a href="https://store.x-plane.org/myaccount.asp" class="menu">My Account</a></li>
 
<li><a href="https://store.x-plane.org/" class="menu" target="_self">Home</a></li>
<li><a href="https://store.x-plane.org/About-Us-_ep_7.html" class="menu" target="_self">About Us </a></li>
<li><a href="https://store.x-plane.org/myaccount.asp" class="menu" target="_self">My Account</a></li>
<li><a href="https://store.x-plane.org/Gift-Certificate_p_8.html" class="menu" target="_self">Gift Certificates</a></li>
<li><a href="https://store.x-plane.org/Updates_ep_32.html" class="menu" target="_blank">Updates</a></li>
 
</ul>
 
<div>
 
 
Hello Robin Banfield, <a href="https://store.x-plane.org/logout.asp" class=""> Logout</a>
 
</div>
</nav>
<nav id="categories-outer" class="hasFlex navbar-collapse collapse">
<div id="menubar_m1"><ul class="nav navbar-nav" id="cat-links" style="position:relative; ">
<li class="r-l" onmouseover="chgBg(m1,'m1tlm0',3);exM(m1,'m1mn1','m1tlm0',event)" onmouseout="chgBg(m1,'m1tlm0',0);coM(m1,'m1mn1')" id="m1tlm0" onmousedown="f58('m1tlm0a')"><a id="m1tlm0a" style="color:#fff;text-underline:none;" href="https://store.x-plane.org/Airliners_c_75.html" target="">Airliners</a></li>
<li class="r-l" onmouseover="chgBg(m1,'m1tlm1',3);exM(m1,'m1mn2','m1tlm1',event)" onmouseout="chgBg(m1,'m1tlm1',0);coM(m1,'m1mn2')" id="m1tlm1" onmousedown="f58('m1tlm1a')"><a id="m1tlm1a" style="color:#fff;text-underline:none;" href="https://store.x-plane.org/General-Aviation_c_42.html" target="">General Aviation</a></li>
<li class="r-l" onmouseover="chgBg(m1,'m1tlm2',3);exM(m1,'m1mn3','m1tlm2',event)" onmouseout="chgBg(m1,'m1tlm2',0);coM(m1,'m1mn3')" id="m1tlm2" onmousedown="f58('m1tlm2a')" style="color: rgb(255, 255, 255); cursor: default;"><a id="m1tlm2a" style="color: rgb(255, 255, 255);" href="https://store.x-plane.org/Helicopters_c_28.html" target="">Helicopters</a></li>
<li class="r-l" onmouseover="chgBg(m1,'m1tlm3',3);exM(m1,'m1mn4','m1tlm3',event)" onmouseout="chgBg(m1,'m1tlm3',0);coM(m1,'m1mn4')" id="m1tlm3" onmousedown="f58('m1tlm3a')"><a id="m1tlm3a" style="color:#fff;text-underline:none;" href="https://store.x-plane.org/Warbirds-and-Military_c_35.html" target="">Warbirds and Military</a></li>
<li class="r-l" onmouseover="chgBg(m1,'m1tlm4',3);exM(m1,'m1mn5','m1tlm4',event)" onmouseout="chgBg(m1,'m1tlm4',0);coM(m1,'m1mn5')" id="m1tlm4" onmousedown="f58('m1tlm4a')"><a id="m1tlm4a" style="color:#fff;text-underline:none;" href="https://store.x-plane.org/More-Aircraft_c_50.html" target="">More Aircraft</a></li>
<li class="r-l" onmouseover="chgBg(m1,'m1tlm5',3);exM(m1,'m1mn6','m1tlm5',event)" onmouseout="chgBg(m1,'m1tlm5',0);coM(m1,'m1mn6')" id="m1tlm5" onmousedown="f58('m1tlm5a')"><a id="m1tlm5a" style="color:#fff;text-underline:none;" href="https://store.x-plane.org/Scenery-_c_56.html" target="">Scenery </a></li>
<li class="r-l" onmouseover="chgBg(m1,'m1tlm6',3);exM(m1,'m1mn7','m1tlm6',event)" onmouseout="chgBg(m1,'m1tlm6',0);coM(m1,'m1mn7')" id="m1tlm6" onmousedown="f58('m1tlm6a')" style="color: rgb(255, 255, 255); cursor: default;"><a id="m1tlm6a" style="color: rgb(255, 255, 255);" href="https://store.x-plane.org/Utilities_c_65.html" target="">Utilities</a></li>
<li class="r-l" onmouseover="chgBg(m1,'m1tlm7',3);exM(m1,'m1mn8','m1tlm7',event)" onmouseout="chgBg(m1,'m1tlm7',0);coM(m1,'m1mn8')" id="m1tlm7" onmousedown="f58('m1tlm7a')" style="color: rgb(255, 255, 255); cursor: default;"><a id="m1tlm7a" style="color: rgb(255, 255, 255);" href="https://store.x-plane.org/Joysticks_c_93.html" target="">Joysticks</a></li>
<li class="r-l" onmouseover="chgBg(m1,'m1tlm8',3);exM(m1,'none','',event)" onmouseout="chgBg(m1,'m1tlm8',0,1)" id="m1tlm8" onmousedown="f58('m1tlm8a')" style="color: rgb(255, 255, 255); cursor: default;"><a id="m1tlm8a" href="https://store.x-plane.org/Specials_c_137.html" style="color: rgb(255, 255, 255);" target="">Specials</a></li>
<li class="r-l" onmouseover="chgBg(m1,'m1tlm9',3);exM(m1,'none','',event)" onmouseout="chgBg(m1,'m1tlm9',0,1)" id="m1tlm9" onmousedown="f58('m1tlm9a')" style="color: rgb(255, 255, 255); cursor: default;"><a id="m1tlm9a" href="https://store.x-plane.org/New_c_160.html" style="color: rgb(255, 255, 255);" target="">New</a></li>
 
</ul></div>
<script type="text/javascript" src="./Welcome to X-Plane.Org Software Store -_files/menu.asp.Без названия"></script>
</nav>
</section>
 
<main id="contentContainer">
<section id="orderHistory">
<div class="container">
<div class="row">
<div class="header row clearfix">
<div class="col-sm-3 col-xs-12 pull-right">
<div class="button text-right"><a href="https://store.x-plane.org/myaccount.asp" class="icon-btn icon-btn-prev">Back to My Account</a></div>
</div>
<div class="col-sm-9 col-xs-12">
<h1 class="page_headers">Recent Orders</h1>
</div>
</div>
<div class="message">Your Order history.</div>
 
<div class="row">
<div class="trackOrders3 col-lg-12">
<div class="header clearfix">
<h3><a href="https://store.x-plane.org/ordertrackingX.asp?sec=ord">Orders</a> | <span style="background-color:#2b517d;color: white;padding: 3px 10px 3px 10px;border-radius: 25px;">Products</span></h3>
 
<div class="dropdown-format pull-right">
<span style="font-size:11px;font-weight:bold">Sorting by:</span>
<select name="drpHistory" onchange="changeGridSort(this);" class="txtBoxStyle" style="padding: 4px 4px">
<option selected="" value="date">Date</option><option value="name">Name</option><option value="sku">SKU</option>
</select>
</div>
 
 
</div>
<div class="row trackOrders_titles titles2 hidden-xs">
<div class="col-lg-2 col-sm-2">
<label for="onum3">Invoice</label>
</div>
<div class="col-lg-2 col-sm-2">
<label for="odate3">Date</label>
</div>
<div class="col-lg-3 col-sm-3">
<label for="oitemID3">Item ID</label>
</div>
<div class="col-lg-3 col-sm-3 text-left">
<label for="oitem3">Item</label>
</div>
<div class="col-lg-2 col-sm-2 text-right">
<label for="odownload3">Download</label>
</div>
</div>
 
<div class="row trackOrders_details details_row">
<div class="col-lg-2 col-sm-2">
<div class="row">
<label class="visible-xs col-xs-4" for="onum3">Invoice</label>
<div class="col-sm-12 col-xs-8">629794</div>
</div>
</div>
<div class="col-lg-2 col-sm-2">
<div class="row">
<label class="visible-xs col-xs-4" for="odate3">Date</label>
<div class="col-sm-12 col-xs-8">5/9/2018</div>
</div>
</div>
<div class="col-lg-3 col-sm-3">
<div class="row">
<label class="visible-xs col-xs-4" for="oitemID3">Item ID</label>
<div class="col-sm-12 col-xs-8">JustFlight-TB10-20</div>
</div>
</div>
<div class="col-lg-3 col-sm-3 text-left">
<div class="row">
<label class="visible-xs col-xs-4" for="oitem3">Item</label>
<div class="col-sm-12 col-xs-8">TB-10 TOBAGO &amp; TB-20 TRINIDAD<br>Serial: XX-XXXXXX-XXXXXX-XXXXXX-AAXCPY</div>
</div>
</div>
<div class="col-lg-2 col-sm-2 text-right">
<div class="row">
<label class="visible-xs col-xs-4" for="odownload3">Download</label>
 
<div class="col-sm-12 col-xs-8"><a href="https://store.x-plane.org/order_eproduct.asp?action=edownload&amp;eid=2ECCBA59t5QBjCj" target="_blank" class="icon-btn icon-btn-refresh">Download Item</a></div>
 
</div>
</div>
</div>
<div class="row trackOrders_details details_row">
<div class="col-lg-2 col-sm-2">
<div class="row">
<label class="visible-xs col-xs-4" for="onum3">Invoice</label>
<div class="col-sm-12 col-xs-8">363893</div>
</div>
</div>
<div class="col-lg-2 col-sm-2">
<div class="row">
<label class="visible-xs col-xs-4" for="odate3">Date</label>
<div class="col-sm-12 col-xs-8">9/16/2016</div>
</div>
</div>
<div class="col-lg-3 col-sm-3">
<div class="row">
<label class="visible-xs col-xs-4" for="oitemID3">Item ID</label>
<div class="col-sm-12 col-xs-8">Carenado-CT210M</div>
</div>
</div>
<div class="col-lg-3 col-sm-3 text-left">
<div class="row">
<label class="visible-xs col-xs-4" for="oitem3">Item</label>
<div class="col-sm-12 col-xs-8">CT210M CENTURION II HD SERIES</div>
</div>
</div>
<div class="col-lg-2 col-sm-2 text-right">
<div class="row">
<label class="visible-xs col-xs-4" for="odownload3">Download</label>
 
<div class="col-sm-12 col-xs-8"><a href="https://store.x-plane.org/order_eproduct.asp?action=edownload&amp;eid=uEHVF7CcqpRIChi" target="_blank" class="icon-btn icon-btn-refresh">Download Item</a></div>
 
</div>
</div>
</div>
<div class="row trackOrders_details details_row">
<div class="col-lg-2 col-sm-2">
<div class="row">
<label class="visible-xs col-xs-4" for="onum3">Invoice</label>
<div class="col-sm-12 col-xs-8">363394</div>
</div>
</div>
<div class="col-lg-2 col-sm-2">
<div class="row">
<label class="visible-xs col-xs-4" for="odate3">Date</label>
<div class="col-sm-12 col-xs-8">9/13/2016</div>
</div>
</div>
<div class="col-lg-3 col-sm-3">
<div class="row">
<label class="visible-xs col-xs-4" for="oitemID3">Item ID</label>
<div class="col-sm-12 col-xs-8">Alabeo-DA40</div>
</div>
</div>
<div class="col-lg-3 col-sm-3 text-left">
<div class="row">
<label class="visible-xs col-xs-4" for="oitem3">Item</label>
<div class="col-sm-12 col-xs-8">Alabeo Diamond DA40</div>
</div>
</div>
<div class="col-lg-2 col-sm-2 text-right">
<div class="row">
<label class="visible-xs col-xs-4" for="odownload3">Download</label>
 
<div class="col-sm-12 col-xs-8"><a href="https://store.x-plane.org/order_eproduct.asp?action=edownload&amp;eid=PsrLYJ5L1nUh7x3" target="_blank" class="icon-btn icon-btn-refresh">Download Item</a></div>
 
</div>
</div>
</div>
 
</div>
</div>
 
</div>
</div>
</section>
<script>
  function changeGridSort(objDrpDown){                                       
      var currenturl = jQuery(location).attr('href');                             
      currenturl = removeURLParameter(currenturl, 'sort');                     
      var sort = objDrpDown.options[objDrpDown.selectedIndex].value;     
 
      //console.log('sort:' + sort)
 
      if (currenturl.indexOf('?')!=-1){                                       
          document.location.href = currenturl + '&sort=' + sort;  
      }                                                                       
      else{                                                                   
          document.location.href = currenturl + '?sort=' + sort;  
      }                                                                     
  }                         
 
  function removeURLParameter(url, parameter) {
      //prefer to use l.search if you have a location/link object
      var urlparts = url.split('?');
      if (urlparts.length >= 2) {
 
          var prefix = encodeURIComponent(parameter) + '=';
          var pars = urlparts[1].split(/[&;]/g);
 
          //reverse iteration as may be destructive
          for (var i = pars.length; i-- > 0;) {
              //idiom for string.startsWith
              if (pars[i].lastIndexOf(prefix, 0) !== -1) {
                  pars.splice(i, 1);
              }
          }
 
          url = urlparts[0] + (pars.length > 0 ? '?' + pars.join('&') : "");
          return url;
      } else {
          return url;
      }
  }
</script>
</main>
 
 
<footer class="site-footer">
<div class="container">
<div class="row">
<div class="flexfooter">
<div class="footer-left">
<div>
<div id="FRAME_LINKS">
<div class="visible-xs extrapages-shower">
<a href="https://store.x-plane.org/ordertrackingX.asp?sec=pro#extrapages" role="button" data-toggle="collapse" class="collapsed">Links</a>
</div>
<ul id="extrapages" class="list-unstyled extrapages clearfix">
 
<li class=""><a href="https://store.x-plane.org/Terms-and-Conditions_ep_2-1.html" target="_self" class="menu-bottom">Terms and Conditions</a></li>
<li class=""><a href="https://store.x-plane.org/product_index.asp" target="_self" class="menu-bottom">Product Index</a></li>
<li class=""><a href="https://store.x-plane.org/category_index.asp" target="_self" class="menu-bottom">Category Index</a></li>
 
</ul>
</div>
</div>
 
</div>
<div class="footer-right">
<div class="copyright_txt text-right">
(c) Copyright <script type="text/javascript" language="javascript">var date = new Date(); document.write(date.getFullYear())</script>2022 store-x-plane-org | All Rights Reserved.
</div>
 
<ul class="social-icons list-unstyled list-inline">
<li class="social-icons-label"> Stay Connected</li>
 
 
 
 
<li><a href="https://twitter.com/XPlanedotorg" class="twitter" target="_blank" title="Follow Us on Twitter"><span class="icon-twitter"></span></a></li>
 
 
 
 
</ul>
 
<div>
<img src="./Welcome to X-Plane.Org Software Store -_files/cards.png" alt="payment options" class="">
</div>
<div class="clearfix"></div>
</div>
</div>
</div>
</div>
<div class="copyright">
<div class="container">
<div class="row">
 
<div class="global-footer">
 
<script type="text/javascript" language="JavaScript">
 
var file='/stats/count.asp';
var stats_d=new Date();
var stats_s=stats_d.getSeconds();
var stats_m=stats_d.getMinutes();
var stats_x=stats_s*stats_m;
var prdID = '[catalogid]';
var catID = '[catid]';
stats_f='' + escape(document.referrer); stats_f=stats_f.replace('_','----');
if (navigator.appName=='Netscape'){stats_b='NS';}
if (navigator.appName=='Microsoft Internet Explorer'){stats_b='MSIE';}
if (navigator.appVersion.indexOf('MSIE 3')>0) {stats_b='MSIE';}
stats_u='' + escape(document.URL); stats_u=stats_u.replace('_','----'); stats_w=screen.width; stats_h=screen.height;
stats_v=navigator.appName;
stats_fs = window.screen.fontSmoothingEnabled;
if (stats_v != 'Netscape') {stats_c=screen.colorDepth;}
else {stats_c=screen.pixelDepth;}
stats_j=navigator.javaEnabled();
info='w=' + stats_w + '&h=' + stats_h + '&c=' + stats_c + '&r=' + stats_f + '&u='+ stats_u + '&fs=' + stats_fs + '&b=' + stats_b + '&x=' + stats_x + '&cat=' + catID + '&prd=' + prdID;
document.write('<img src="' + file + '?'+info+ '" width=1 height=1 border=0>');
</script><img src="./Welcome to X-Plane.Org Software Store -_files/count.asp.Без названия" width="1" height="1" border="0" a4rwybf59="">
<noscript>
<img src="/stats/count.asp" width=90 height=30 border=0>
</noscript>
 
</div>
 
</div>
</div>
</div>
</footer>
<a href="https://store.x-plane.org/ordertrackingX.asp?sec=pro#" class="scrollToTop"><i class="icon-angle-up icon-2x"></i> <span class="sr-only">TOP</span></a>
<nav id="mobile-menu" class="mobile-menu">
<div class="mobile-menu-inner">
<div class="mobile-menu-close">
<a href="https://store.x-plane.org/ordertrackingX.asp?sec=pro#"></a>
</div>
<div class="mobile-menu-widget">
<h3>Categories</h3>
<div id="mobile-categories">
<ul id="categories" class="nav navbar-nav">
<li class="dropdown">
<a href="https://store.x-plane.org/Airliners_c_75.html">Airliners</a>
 
<ul class="dropdown-menu animated">
<li class=""><a href="https://store.x-plane.org/Boeing-Airliners_c_5.html" class="subcat">Boeing Airliners</a></li>
<li class=""><a href="https://store.x-plane.org/Airbus-Airliners_c_6.html" class="subcat">Airbus Airliners</a></li>
<li class=""><a href="https://store.x-plane.org/Embraer_c_24.html" class="subcat">Embraer</a></li>
<li class=""><a href="https://store.x-plane.org/McDonnell-Douglas_c_178.html" class="subcat">McDonnell Douglas</a></li>
<li class=""><a href="https://store.x-plane.org/Business-Jets_c_23.html" class="subcat">Business Jets</a></li>
<li class=""><a href="https://store.x-plane.org/Prop-Airliners_c_26.html" class="subcat">Prop Airliners</a></li>
<li class=""><a href="https://store.x-plane.org/Regional-Jets_c_27.html" class="subcat">Regional Jets</a></li>
<li class=""><a href="https://store.x-plane.org/Classic-Airliners_c_131.html" class="subcat">Classic Airliners</a></li>
<li class=""><a href="https://store.x-plane.org/Other-Airliners_c_22.html" class="subcat">Other Airliners</a></li>
<li class=""><a href="https://store.x-plane.org/Bombardier_c_473.html" class="subcat">Bombardier</a></li>
</ul>
 
</li>
<li class="dropdown">
 
 
</body></html>
0
Эксперт по компьютерным сетям
 Аватар для Jabbson
5907 / 3359 / 1036
Регистрация: 03.11.2009
Сообщений: 10,008
17.06.2022, 00:36
Python
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from bs4 import BeautifulSoup
 
with open('testfile.html') as html_data:
    soup = BeautifulSoup(html_data, "html.parser")
 
invoices = soup.select('div.details_row')
 
results = []
for invoice in invoices:
    rows = invoice.select('div.row')
    data = {}
    for row in rows:
        label = row.select_one('label').text.strip()
        value = row.select_one('div').text.strip()
        link = row.select_one('a')            
 
        if label != 'Item':
            if label == 'Download':
                data[label] = link.attrs.get('href')
                continue
            data[label] = value
            
    results.append(data)
 
print(results)
0
 Аватар для Orlov1
100 / 42 / 7
Регистрация: 03.02.2019
Сообщений: 655
21.06.2022, 00:34  [ТС]
Код возвращает :
Code
1
[{'Invoice': '629794', 'Date': '5/9/2018', 'Item ID': 'JustFlight-TB10-20', 'Item': 'TB-10 TOBAGO & TB-20 TRINIDADSerial: 2W-UXW4YP-3ZTJM2-LWFXR9-AAXCPY'}, {'Invoice': '363893', 'Date': '9/16/2016', 'Item ID': 'Carenado-CT210M', 'Item': 'CT210M CENTURION II HD SERIES'}, {'Invoice': '363394', 'Date': '9/13/2016', 'Item ID': 'Alabeo-DA40', 'Item': 'Alabeo Diamond DA40'}, {'Date': '5/9/2018', 'Invoice': '629794\xa0(Download -View Details)', 'Amount': '$41.99', 'Status': 'Completed', 'Invoice Redownload': 'Invoice Redownload'}, {'Date': '9/16/2016', 'Invoice': '363893\xa0(Download -View Details)', 'Amount': '$29.95', 'Status': 'Completed', 'Invoice Redownload': 'Invoice Redownload'}, {'Date': '9/13/2016', 'Invoice': '363394\xa0(Download -View Details)', 'Amount': '$26.95', 'Status': 'Completed', 'Invoice Redownload': 'Invoice Redownload'}, {'Date': '5/9/2018', 'Order #': '629794\xa0(Download -View Details)', 'Amount': '$41.99', 'Status': 'Completed', 'Actions': 'reorder'}, {'Date': '9/16/2016', 'Order #': '363893\xa0(Download -View Details)', 'Amount': '$29.95', 'Status': 'Completed', 'Actions': 'reorder'}, {'Date': '9/13/2016', 'Order #': '363394\xa0(Download -View Details)', 'Amount': '$26.95', 'Status': 'Completed', 'Actions': 'reorder'}, {}, {}, {}]
Мне нужен такой вывод. Каждый инвойс в строку:

629794 5/9/2018 JustFlight-TB10-20 TB-10 TOBAGO & TB-20 TRINIDAD Serial: 2W-UXW4YP-3ZTJM2-LWFXR9-AAXCPY Download Item
363893 9/16/2016 Carenado-CT210M CT210M CENTURION II HD SERIES Download Item
363394 9/13/2016 Alabeo-DA40 Alabeo Diamond DA40 Download Item
0
Эксперт по компьютерным сетям
 Аватар для Jabbson
5907 / 3359 / 1036
Регистрация: 03.11.2009
Сообщений: 10,008
21.06.2022, 01:58
Если нужен - ну сделали бы, там осталось пару строчек поменять, неужто не интересно даже разобраться?

Python
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from bs4 import BeautifulSoup
 
with open('testfile.html') as html_data:
    soup = BeautifulSoup(html_data, "html.parser")
 
invoices = soup.select('div.details_row')
 
for invoice in invoices:
    rows = invoice.select('div.row')
    data = {}
    for row in rows:
        label = row.select_one('label').text.strip()
        value = row.select_one('div').text.strip()
        link = row.select_one('a')            
 
        if label == 'Download':
            data[label] = link.attrs.get('href')
            continue
        data[label] = value
    print(f'{data["Invoice"]} {data["Date"]} {data["Item ID"]} {data["Item"]} {data["Download"]}')
0
Надоела реклама? Зарегистрируйтесь и она исчезнет полностью.
inter-admin
Эксперт
29715 / 6470 / 2152
Регистрация: 06.03.2009
Сообщений: 28,500
Блог
21.06.2022, 01:58
Помогаю со студенческими работами здесь

Спарсить емейл с html
есть сайт на котором эсть пользователи. Как можно загрузив страницу пользователя извлечь дание &lt;li&gt;&lt;i...

Спарсить данные из html
Добрый день! Есть кусок html кода, нужно спарсить данные из data-content. Пробовал разными способами, как getElementsByClassName и...

Спарсить сайт html
Здравствуйте, решил спарсить сайт, скачал готовую библиотеку htmlcxx, как мне использовать библиотеку? Создать свой проект или писать код в...

Спарсить код HTML
Всем привет. Подскажите, как спарсить html код? Спасибо за ответы.

Не могу спарсить html
вот код с сайта &lt;div id=&quot;bonus-bar&quot;&gt; &lt;div class=&quot;row&quot;&gt; &lt;div id=&quot;bonus&quot; class=&quot;medium-12 columns&quot;&gt; ...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
6
Ответ Создать тему
Новые блоги и статьи
http://iceja.net/ математические сервисы
iceja 20.01.2026
Обновила свой сайт http:/ / iceja. net/ , приделала Fast Fourier Transform экстраполяцию сигналов. Однако предсказывает далеко не каждый сигнал (см ограничения http:/ / iceja. net/ fourier/ docs ). Также. . .
http://iceja.net/ сервер решения полиномов
iceja 18.01.2026
Выкатила http:/ / iceja. net/ сервер решения полиномов (находит действительные корни полиномов методом Штурма). На сайте документация по API, но скажу прямо VPS слабенький и 200 000 полиномов. . .
Расчёт переходных процессов в цепи постоянного тока
igorrr37 16.01.2026
/ * Дана цепь постоянного тока с R, L, C, k(ключ), U, E, J. Программа составляет систему уравнений по 1 и 2 законам Кирхгофа, решает её и находит переходные токи и напряжения на элементах схемы. . . .
Восстановить юзерскрипты Greasemonkey из бэкапа браузера
damix 15.01.2026
Если восстановить из бэкапа профиль Firefox после переустановки винды, то список юзерскриптов в Greasemonkey будет пустым. Но восстановить их можно так. Для этого понадобится консольная утилита. . .
Сукцессия микоризы: основная теория в виде двух уравнений.
anaschu 11.01.2026
https:/ / rutube. ru/ video/ 7a537f578d808e67a3c6fd818a44a5c4/
WordPad для Windows 11
Jel 10.01.2026
WordPad для Windows 11 — это приложение, которое восстанавливает классический текстовый редактор WordPad в операционной системе Windows 11. После того как Microsoft исключила WordPad из. . .
Classic Notepad for Windows 11
Jel 10.01.2026
Old Classic Notepad for Windows 11 Приложение для Windows 11, позволяющее пользователям вернуть классическую версию текстового редактора «Блокнот» из Windows 10. Программа предоставляет более. . .
Почему дизайн решает?
Neotwalker 09.01.2026
В современном мире, где конкуренция за внимание потребителя достигла пика, дизайн становится мощным инструментом для успеха бренда. Это не просто красивый внешний вид продукта или сайта — это. . .
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2026, CyberForum.ru