How to get online data from website

Hello people,

Do someone know how to get online data from website and insert it into GH?

Thanks to all for help =))

You probably need to specify this a bit further. But assuming you just need to read some raw text for instance, you can use the standard urllib module:


200623_RunPyCodeFromURL_00 (1).gh (4.0 KB)

1 Like

Sorry, can I download somewhere this standard urllib module?

It’s part of the standard Python library, so you don’t need to download it. Try running the file I posted above and change the URL variable to whatever website you’re trying to read, see what you get.

Swiftlet is for interacting with Web API’s and scrapping.

Available on the package mananger as well

1 Like

Sorry for additional question, where can I get this code, this is what I found on Python library?
image

Did you check out the file I posted above? You simply import urllib in your script :slight_smile:

Yep, sorry

is it possible to extract this numbers from google page?

1 Like

Probably, what’s the URL?

this is how it looks

This or this is what you need. maybe somebody with some Python knowledge can adapt this to work with Grasshopper.

I just need to extract online parameters from websites no more no less

Do you have a sample of how to read it using swiftlet?

Swiftlet is well documented and comes with a number of examples.

Unfortunately it is not working anymore if I do make a modification to the gist file. It is displaying only the old content but not the actualized one.

There appears to be a GitHub issue where the raw representation of the source file is not immediately updated (took a few minutes on my test just now). Anywho, the code still works. So maybe just host your data elsewhere and read it from there, if that lag is a concern.

How you are getting the RAW URL (https://raw.githubusercontent.com/AndersDeleuran/ahd/main/ahd.py)?

I do get only a URL like this:
https://gist.github.com/username/94fa000f2671400211a9bd330163c32b

That link doesn’t work for me. Anywho, for a gist one can press this button:

1 Like