Jump to content
UBot Underground

Question: Determining The "weight" / Size Of A Web Page To Which You Have Navigated -- Impossible?


Recommended Posts

Hi! Question:

 

1) You navigate to a webpage using the UScript "navigate" command.

2) Now you want to determine the kilobyte/megabyte size of the data contained on the webpage.

 

Any thoughts or perspectives on whether or not this can be accomplished with either native UScript code or alternatively via a plugin?

 

Thanks in advance for any insights.

Link to post
Share on other sites

Download the page is a good start:

download file("http://www.ubotstudio.com/resources","{$special folder("Desktop")}/page.html")

There are plugins that will tell you info about the file like file size, I'm sure there is a function in File Management Plugin or maybe Heopas Plugin.

 

You could download the scripts and images contained in the HTML as well if you needed to see how much data that takes up as well.

Link to post
Share on other sites

Hi Nick,

 

Thank you so much for taking the time to reply. Sometimes it's useful to get someone else's perspective on how to potentially obtain a solution.

 

Oddly enough, neither Aymen's File Management plugin nor the Heopas plugin contain Functions or Parameters that would appear to produce a file size. For example, the "$file info" parameter within Aymen's File Functions plugin provides these options:

-Get Creation Time
-Get Last Write Time
-Get Last Access Time

 

(They're phenomenal plugins, I should add, and appreciate you bringing them to my attention!)

 

It occurred to me there might be away to obtain file size information by leveraging UBot Studio's built-in support for Python.

 

Sure enough, this actually produced a measurable number:

download file("http://www.ubotstudio.com/resources","{$special folder("Desktop")}/page.html")

set(#FileInformation,$python result("FileSize","import os

os.path.getsize(\'{$special folder("Desktop")}\\page.html\')"),"Global")

(This wouldn't have been achievable absent your reply, which kinda triggered more thinking on my part.)

 

You mentioned something intriguing:

 

 

 

You could download the scripts and images contained in the HTML as well if you needed to see how much data that takes up as well.

 

 

 

My original vision was to block the loading of images so as to remove this as a potential variable associated with attempting to measure the amount of bandwidth that could potentially be consumed. However, considering that various tracking pixels are, to the best of my knowledge, image files, it might be shortsighted to block images.

 

Would you propose scouring the code of the page being loaded for any HTML "img" tags and then subsequently downloading those files as well so that they can be measured for size?

 

(The rationale for wanting to measure all of this file size information stems from having to calculate potential paid proxy bandwidth costs.)

 

Any additional insights or perspectives you might have are appreciated, as always.

 

^Stephen

Link to post
Share on other sites

File Folder Addons by BotGuru & Elite Ubot (paid) have functions to report file size. I thought maybe one of the free ones had it and it turns out its the one by BotGuru I believe it's in that 21 free plugins package you can download here: https://network.ubotstudio.com/forum/index.php/topic/20737-21-free-plugins-being-given-away/

 

Images and scripts can take bandwith yes, but they can also be cached keep that in mind as well, and so they may not always be needed to be downloaded.

 

There are site speed checkers out there like pingdom. They typically tell you the file size of the site. If you wanted to you could maybe let them figure that out and then just create a bot that scrapes the info from them. https://tools.pingdom.com

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...