i am doing a project in which i need to get the information from webpages. i am using python and ghost for it. i saw this code in the documentation:
links = gh.evaluate("""
var linksobj = document.querySelectorAll("a");
var links = [];
for (var i=0; i<linksobj.length; i++){
links.push(linksobj[i].value);
}
links;
""")
this code is definitely not python. which language is it and where i can learn how to configure it? how can find a string from the tags eg. in:
title>this is title of the webpagehow can i get
this is title of the page
thanks.
ghost.py
is a webkit client. It allows you to load a web page and interact with its DOM and runtime.
This means that once you have everything installed and running, you can simply do this:
from ghost import Ghost
ghost = Ghost()
page, resources = ghost.open('http://stackoverflow.com/')
if page.http_status == 200:
result, extra = ghost.evaluate('document.title;')
print('The title is: {}'.format(result))