Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Extract python/other programming code from html (converted from Jupyter notebook)
#9
Hi Gintaras,

Your method of elm.Html. with HtmlAgilityPack is perfect combination. Now I can easily extract any text or other format (I mean any Elm) I wanted from any webpage.
That's so nice!
Thank you so much! 
 
Code:
Copy      Help
// script ""
/*/ nuget -\HtmlAgilityPack; /*/

//https://zerotomastery.io/cheatsheets/python-cheat-sheet/


using HtmlAgilityPack;

var w = wnd.find(1, "The Best Python Cheat Sheet | Zero To Mastery - Google Chrome", "Chrome_WidgetWin_1");
foreach (var e in w.Elm["web:GROUPING", prop: "@id=cheatsheet-content"]["TEXT", prop: "level=2"].FindAll()) {
var html = e.Html(false);
var doc1 = new HtmlDocument();
doc1.LoadHtml(html);
print.it(doc1.DocumentNode.InnerText);    
}


Messages In This Thread
RE: Extract python/other programming code from html (converted from Jupyter notebook) - by birdywen - 07-31-2023, 01:26 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)