Commit Diff


commit - fb3c63beea23960f42f6eb32976899722bfc81be
commit + 9c8ec235f12869d3d6c8b3eb20f598b5ae9dd96e
blob - 797f4587ce175b4cb3b97be15697251a90671ef2
blob + ffff8f49abe14f79cbc81439814591e53f28cd6a
--- avk.py
+++ avk.py
@@ -1,5 +1,6 @@
 from http.cookiejar import CookieJar, Cookie
 from urllib.request import build_opener, HTTPCookieProcessor
+from html.parser import HTMLParser
 
 
 cookiejar = CookieJar()
@@ -33,4 +34,18 @@ cookiejar.set_cookie(
 
 
 with opener.open("https://m.vk.com/rtpbooks") as response:
-    print(response.read().decode("utf8"))
+    html_page = response.read().decode("utf8")
+
+class MyHTMLParser(HTMLParser):
+    def handle_starttag(self, tag, attrs):
+        print(f"> {tag} {attrs=}")
+
+    def handle_endtag(self, tag):
+        print(f"< {tag}")
+
+    def handle_data(self, data):
+        print(f"{data=}")
+
+
+parser = MyHTMLParser()
+parser.feed(html_page)