Skip to content

Instantly share code, notes, and snippets.

View franciscobatista356's full-sized avatar

franciscobatista356

View GitHub Profile
{"ns": 0,
"pageid": 44254295,
"terms": {"alias": ["Avengers Endgame", "Avengers End Game", "Avengers 4"],
"description": ["2019 superhero film produced by Marvel Studios"],
"label": ["Avengers: Endgame"]},
"title": "Avengers: Endgame"}
from requests_html import HTMLSession
#Builds a DOM path recursively
def build_dom_path(element, path):
if element is None:
return path
else:
path.append(element.tag)
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>This is a test</title>
<link rel="canonical" href="http://localhost">
<meta name="description" content="This is a test">
<meta name="author" content="Hamlet Batista">
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>This is a test</title>
<meta name="description" content="This is a test">
<meta name="author" content="Hamlet Batista">
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>This is a test</title>
<meta name="description" content="This is a test">
<meta name="author" content="Hamlet Batista">
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>This is a test</title>
<meta name="description" content="This is a test">
<meta name="author" content="Hamlet Batista">