476179

girl idk - trying to write the finance bot D:

Jun 8th, 2022
18
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. a half ass introduction to web scraping with python, courtesy of RealPython.com and my digestive tract, which has chewed it up, partially digested the material, and am now going to make like Reva and spit it all back up for you baby :)) why cant i just be like ben(the kate moss of coding), NO FAIRR!
  2.  
  3.  
  4.  
  5. ok queen, first we are going import the module which has all the web functions, spec: url-open(), from url library
  6. from urllib.request import urlopen
  7. object is assigned to the url for easy accessing
  8. url = "http:qwerty_youGetThePoint.com"
  9. pass url to urlopen()
  10. page = urlopen(url)
  11. itll return a HTTP-Response object
  12. page <http.client.HTTPResponse object at *123someMemoryAddy456"
  13.  
  14. period
  15. NOW TO EXTRACT HTML FROM THE PAGE
  16. were gonna assign bytes to another variable(1), then we'll go on to decode it using UTF-8(2), the unicode conversion, meaning, the bytes are a string of numbers which represent the whole page's text and formatting of that text
  17. (1) html_bytes = page.read()
  18. (2) html = html_bytes.decode("utf-8")
  19.  
  20. hot, now html contains the webbpage's html!
  21.  
  22.  
  23.  
  24. now onto dataParsing: Reading files to filth
  25.  
  26.  
  27. Opion 1 - the Slay of the Strings
  28.  
  29. were gonn use the .find() func, itll return the index of the first character in the argument in the func
  30. index = html.find("pussy")
  31. >> itll return the index of p, or -1 if not found at all,
  32. she is case sensitive, she is also emotionally very sensitive, so watch your mouth..
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
Add Comment
Please, Sign In to add comment