Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2014
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. <div class="person-info">
  2. <div class="title ng-binding">Helen Brad in household of Geo Wilcock</div>
  3. <div class="subhead ng-scope ng-binding" data-ng-if="!recordPersonCentric">Canada Census, 1901</div>
  4.  
  5. import urllib2
  6. import re
  7. import csv
  8. from bs4 import BeautifulSoup
  9. import time
  10.  
  11. def get_FamSearch():
  12.  
  13. link = "https://familysearch.org/pal:/MM9.1.1/KH21-21V"
  14. openLink = urllib2.urlopen(link)
  15. Soup_FamSearch = BeautifulSoup(openLink, "html")
  16. openLink.close()
  17.  
  18. NameParentTag = Soup_FamSearch.find("tr", class_="result-item highlight-person")
  19. if NameParentTag:
  20. Name = NameParentTag.find("td", class_="result-value-bold").get_text(strip=True)
  21. name_decode = Name.encode("ascii", "ignore")
  22. print name_decode
  23.  
  24. SubheadTag = Soup_FamSearch.find("div", class_="subhead ng-scope ng-binding")
  25. if SubheadTag:
  26. print SubheadTag.get_text(strip=True)
  27.  
  28. get_FamSearch()
  29.  
  30. Helen Brad
  31. [Finished in 2.2s]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement