thanks I'll have a read!Check this article on how I did my scraping, perhaps it can help.
Running a web-scraper on my TailwindCSS Website
Well, I can safely confirm that one of the things on my bucket list has been ticked off. Ha ha ha.mbanga-anele.medium.com
to quote Erel:I am trying to scrape the webpage from a USB dongle for 4g (I want to get the IMEI etc).
You could be start with a B4X solution
Or with a specific B4A solution like:MiniHtmlParser - simple html parser implemented with B4X
MiniHtmlParser is a cross platform class that parses html strings and creates a tree with the various elements.
jSoup HTML Parser
This solution is specific to B4A and allows you to search specifically for a piece of code into the HTML page
so, I am trying to scrape a website for the Imei which is in plain text in the HTML of the loaded page, not through an android device.to quote Erel:
You could be start with a B4X solution
Or with a specific B4A solution like:
chromium-browser --headless --dump-dom --virtual-time-budget=10000 192.168.8.1/html/content.html#device-information
Might be worth checking if it's a security feature of the dongle. An attempt to prevent hacking maybe?his returns the page without populating the div I need populated
that's a good thought, I'll see what I can find out!Might be worth checking if it's a security feature of the dongle. An attempt to prevent hacking maybe?
this returns the page without populating the div I need populated. the same happens with OKHttpUtils download function.
so I have tried this, the page seems to be correct HTML, with or without the div I am trying to get.If there is an error on your dongle web page then a red line is showed, if not your page source is OK.
- Open Firefox or Chrome browser
- Open web page
- Open new tab page with this url: https://formatteronline.com/html
- Open new tab page and load your page
- Right click loaded web page
- Show source web page
- Select all page source with Ctrl-A
- copy all page source with Ctrl-V
- Go back to https://formatteronline.com/html
- Paste your web page source
- Click format button
It is possible that the web page is malformed. In that case go to your loaded dongle web page and right click the mouse om the loaded web page and click on inspect to show the DOM source. go to the first line and edit as HTML. then repeat point 7 till 11.
Be aware that it is verry important to use the same text string as showed in the original (DOM) page source because parsing takes place on a one to one character match between your source string and the loaded web page source string.
Dim myResponseString1 As String = ""
Dim JobScrapeDonglePageHTML1 As HttpJob
JobScrapeDonglePageHTML1.Initialize("JobScrapeDonglePageHTML1",Me)
JobScrapeDonglePageHTML1.Download("http://192.168.8.1/html/content.html#deviceinformation")
Wait For jobdone(job As HttpJob)
If job.Success Then
myResponseString1 = job.GetString2("UTF8").Trim
'If job.Response.StatusCode = 200 Then
'Log("the repsonse from download dongle page information" & myResponseString1)
File.WriteString("/home/pi/CollatorStartup","DonglePageinfo.html", myResponseString1)
If myResponseString1.Contains("IMEI") Then
Log("IMEI found!")
'File.WriteString("/home/pi/CollatorStartup","DonglePage.txt", myResponseString)
End If
Log("scraped info page")
'End If
Else
Log("job failed")
Log(stderr)
End If
I think you're right, thank you!I think that you want to get a content that is dinamically generatad by JavaScript.
Some time ago I was looking for the same and YES, you can do it with B4J, but it's not so easy to do (at least for me).
You will need to use a WebView with WebView extras and activate JavaScript rendering on it.
There is many content in the forum about this.
Good luck ?
the program I've written is a non UI one, my understanding is that I can't use a web view with this?Does it show correctly if you display it in a webview? Directly from the URL rather than downloading the html first.
If it does, there may be an easier way to get the information you want.
If you decide to do that, let me know as I was thinking of using the WebEngine directly, probably no need for a webview. But it still needs javafxwhy not make it a UI app and just not display the form holding the webview
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?