Brute force solution:
Sub Class_Globals
Private Root As B4XView
Private xui As XUI
Private parser As MiniHtmlParser
End Sub
Public Sub Initialize
End Sub
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
parser.Initialize
End Sub
Private Sub Button1_Click
Dim j As HttpJob
j.Initialize("", Me)
j.Download("https://www.pdfdrive.com/python-books.html")
Wait For (j) JobDone(j As HttpJob)
If j.Success Then
ParseHtml(j.GetString)
End If
j.Release
End Sub
Private Sub ParseHtml(html As String)
Dim RootNode As HtmlNode = parser.Parse(html)
ParseChildren(RootNode)
End Sub
Private Sub ParseChildren (parent As HtmlNode)
If IsFileImgClass(parent) Then
Log("*******************")
For Each attr As HtmlAttribute In parent.Attributes
Log($"${attr.Key}: ${attr.Value}"$)
Next
End If
For Each c As HtmlNode In parent.Children
ParseChildren(c)
Next
End Sub
Private Sub IsFileImgClass(parent As HtmlNode) As Boolean
If parent.Name = "img" Then
For Each attr As HtmlAttribute In parent.Attributes
If attr.Key = "class" And attr.Value.Contains("file-img") Then Return True
Next
End If
Return False
End Sub
Waiting for debugger to connect...
Program started.
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
*******************
class: img-zoom file-img
src:
https://cdn.asaha.com/assets/thumbs/141/1412313ed6c2dc776f148dc730ad7b82-s.jpg
original:
https://cdn.asaha.com/assets/thumbs/141/1412313ed6c2dc776f148dc730ad7b82-s.jpg
alt: A Python Book: Beginning Python, Advanced Python, and Python
title: A Python Book: Beginning Python, Advanced Python, and Python
loading: lazy
*******************
class: img-zoom file-img
src:
https://cdn.asaha.com/assets/thumbs/44c/44c75150d2524b17919d1dcf02c483ba-s.jpg
original:
https://cdn.asaha.com/assets/thumbs/44c/44c75150d2524b17919d1dcf02c483ba-s.jpg
alt: Learn Python in One Day and Learn It Well: Python for Beginners with Hands-on Project. The only book you need to start coding in Python immediately
title: Learn Python in One Day and Learn It Well: Python for Beginners with Hands-on Project. The only book you need to start coding in Python immediately
loading: lazy
*******************
class: img-zoom file-img
src:
https://cdn.asaha.com/assets/thumbs/f03/f03acfa6e2959196a6aa252445b4c6c4-s.jpg
original:
https://cdn.asaha.com/assets/thumbs/f03/f03acfa6e2959196a6aa252445b4c6c4-s.jpg
alt: Python Programming. Python Programming for Beginners, Python Programming for Intermediates
title: Python Programming. Python Programming for Beginners, Python Programming for Intermediates
loading: lazy
*******************
class: img-zoom file-img
src:
https://cdn.asaha.com/assets/thumbs/1e2/1e26b49538fa00558f742f66cbcec016-s.jpg
original:
https://cdn.asaha.com/assets/thumbs/1e2/1e26b49538fa00558f742f66cbcec016-s.jpg
alt: automate the boring stuff with python automate the boring stuff with python
title: automate the boring stuff with python automate the boring stuff with python
loading: lazy
*******************
class: img-zoom file-img
src:
https://cdn.asaha.com/assets/thumbs/d70/d70605c8d404b6303b9275ff2a7e2502-s.jpg
original:
https://cdn.asaha.com/assets/thumbs/d70/d70605c8d404b6303b9275ff2a7e2502-s.jpg
alt: Mastering Machine Learning with Python in Six Steps: A Practical Implementation Guide to Predictive Data Analytics Using Python
title: Mastering Machine Learning with Python in Six Steps: A Practical Implementation Guide to Predictive Data Analytics Using Python
loading: lazy
*******************
class: img-zoom file-img
src:
https://cdn.asaha.com/assets/thumbs/6b1/6b11804596aef6423d5dcb4d4f03b364-s.jpg
original:
https://cdn.asaha.com/assets/thumbs/6b1/6b11804596aef6423d5dcb4d4f03b364-s.jpg
alt: Python Data Analytics: Data Analysis and Science Using Pandas, matplotlib, and the Python
title: Python Data Analytics: Data Analysis and Science Using Pandas, matplotlib, and the Python
loading: lazy
*******************
class: img-zoom file-img
src:
https://cdn.asaha.com/assets/thumbs/1e3/1e3fb1af9b6ec585d23f37989f5d4d65-s.jpg
original:
https://cdn.asaha.com/assets/thumbs/1e3/1e3fb1af9b6ec585d23f37989f5d4d65-s.jpg
alt: Gray hat Python : Python programming for hackers and reverse
title: Gray hat Python : Python programming for hackers and reverse
loading: lazy
*******************
class: img-zoom file-img
src:
https://cdn.asaha.com/assets/thumbs/f9a/f9a9d4354f989d49f7b31d1ab5681421-s.jpg
original:
https://cdn.asaha.com/assets/thumbs/f9a/f9a9d4354f989d49f7b31d1ab5681421-s.jpg
alt: A Python Book: Beginning Python, Advanced Python, and Python Exercises
title: A Python Book: Beginning Python, Advanced Python, and Python Exercises
loading: lazy