Running Nokogiri in a simple task - getting data and storing it in sqlite db

hello dear Ruby-experts,

i fairly new to imple_html_dom usage and methods. I know a little the parser,
i want to gather some information from this site:

https://europa.eu/youth/volunteering/organisations_en#open

is this possible to get the content - of let us say 10 or 20 last records on that page - and subesquently to store it in my mysql - db!?

import requests
from bs4 import BeautifulSoup
 
url = 'https://europa.eu/youth/volunteering/organisations_en#open'
response = requests.get(url)
soup = BeautifulSoup(response.content, 'lxml')
print(soup.find('title').text)
block = soup.find('div', class_="eyp-card block-is-flex")

and this

European Youth Portal
>>> block.a
<a href="/youth/volunteering/organisation/50113_en" target="_blank">"Common Sense" Youth Organization PU</a>
>>> block.a.text
'"Academy for Peace and Development" Union'
 
>>> block.select_one('div > div > p:nth-child(9)')
<p><strong>PIC:</strong> 947847141</p>
>>> block.select_one('div > div > p:nth-child(9)').text
'PIC: 947847141'

i think creating this with Ruby is more efficient -
the main goal is to get some of the first 20 results and to put it in a list or to store it in a sqlite-db

i also tried to do this in PHP … too

<?php
// Report all PHP errors (see changelog)
error_reporting(E_ALL);

include('inc/simple_html_dom.php');

    //base url
    $base = 'https://europa.eu/youth/volunteering/organisations_en#open';

    //home page HTML
    $html_base = file_get_html( $base );

    //get all category links
    foreach($html_base->find('a') as $element) {
        echo "<pre>";
        print_r( $element->href );
        echo "</pre>";
    }

    $html_base->clear(); 
    unset($html_base);

?>

I have the above code and I’m trying to get certain elements of the page but it isn’t returning anything.
Is it possible that certain PHP functions might be disabled on the server to stop that?

The above code works perfectly on other sites.

Is there any workaround?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs