For some work I do, I need to gather data regarding job titles and how frequent they are in search results so I decided to enlist Python to help me with this. Only problem is that I can't seem to figure out why this code fragment I found isn't giving me the right info I need. Here's what I have so far:
import requests
from bs4 import BeautifulSoup
from collections import Counter
from string import punctuation
# We get the url
r = requests.get("https://www.usajobs.gov/Search/Results?j=0602&d=VA&p=1")
soup = BeautifulSoup(r.content, "html.parser")
# We get the words within divs
text_div = (''.join(s.findAll(text=True))for s in soup.findAll('div'))
c_div = Counter((x.rstrip(punctuation).lower() for y in text_div for x in y.split()))
total = c_div
print(total)
I know that part of this involves inspecting the code but I can't figure out what I need to input to get the scraper to narrow down to these titles:
<a id="usajobs-search-result-0" class="usajobs-search-result--core__title search-joa-link" href="/GetJob/ViewDetails/568337700" itemprop="title" data-document-id="568337700">
Would appreciate any help
